mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
mcMMO -> All changes up to 0.6.2
vStopFire -> All changes up to 1.1 WoolPlus -> All changes up to 1.2 vPlayersOnline -> All changes up to 1.5
This commit is contained in:
parent
09ca2b3b0d
commit
38f24bee62
@ -1,152 +1,161 @@
|
||||
Changelog:
|
||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
|
||||
Version 0.5.17
|
||||
|
||||
Changed namespaces to fit bukkits new standard
|
||||
Adjusted excavation proc rates
|
||||
Modified excavation loot tables
|
||||
Added Party Invite System
|
||||
|
||||
Version 0.5.16
|
||||
|
||||
Fixed unarmed not checking for permissions when hitting players
|
||||
|
||||
Version 0.5.15
|
||||
Fixed stone swords not being recognized as swords
|
||||
Fixed /a not working if you were an op but did not have permissions
|
||||
|
||||
Version 0.5.14
|
||||
Added permissions for skills
|
||||
|
||||
Version 0.5.13
|
||||
|
||||
Removed skillgain from succesful parries
|
||||
Repair now refreshed the inventory
|
||||
|
||||
Version 0.5.12
|
||||
|
||||
Fixed being able to hurt party members with the bow and arrow
|
||||
|
||||
Version 0.5.11
|
||||
|
||||
Added /mmoedit command
|
||||
Fixed bug preventing player versus player damage
|
||||
Fixed bug preventing damage from scaling with unarmed & bows
|
||||
Fixed disarm proc making the opponent dupe his/her items
|
||||
Added mcmmo.tools.mmoedit permission
|
||||
Added mcmmo.commands.setmyspawn permission
|
||||
Added totalskill to /stats
|
||||
Changed the look of /stats
|
||||
|
||||
Version 0.5.10
|
||||
|
||||
Fixed trying to set health to an invalid value
|
||||
|
||||
Version 0.5.9
|
||||
|
||||
Fixed duping inventories on death
|
||||
|
||||
Version 0.5.8
|
||||
|
||||
Fixed bug where players inventories would dupe during combat
|
||||
|
||||
Version 0.5.7
|
||||
|
||||
Fixed monsters instant killing players
|
||||
Misc fixes
|
||||
Version 0.5.4
|
||||
|
||||
Changed herbalism skill gain from wheat to be WAAAAY slower
|
||||
|
||||
Version 0.5.3
|
||||
|
||||
Players will now correctly drop their inventories when killed by a monster
|
||||
|
||||
Version 0.5.2
|
||||
|
||||
Fixed MAJOR bug preventing swords skill from gaining through combat
|
||||
|
||||
Version 0.5
|
||||
|
||||
Archery Added
|
||||
Swords Added
|
||||
Acrobatics Added
|
||||
Logging for Party/Admin chat added
|
||||
Fixed whois to show correct values for Excavation
|
||||
Made death messages much much more specific
|
||||
|
||||
Version 0.4.4
|
||||
|
||||
Fixed being able to repair full durability iron tools
|
||||
Fixed herbalism benefits not behaving properly
|
||||
Fixed removing 1 diamond from every stack of diamond when repairing diamond
|
||||
|
||||
Version 0.4.2
|
||||
|
||||
Removed myspawn from the motd
|
||||
|
||||
Version 0.4.1
|
||||
|
||||
Fixed /mcc showing incorrect command for herbalism
|
||||
Changed unarmed skillrate to be much slower than before
|
||||
Modified a few skill descriptions
|
||||
Added permission for /whois
|
||||
Players can now use admin chat without being op as long as they have the correct permission (requires Permissions)
|
||||
|
||||
Version 0.4
|
||||
|
||||
Permissions support
|
||||
Removed OPs having different names than normal players
|
||||
Removed /setspawn & /spawn
|
||||
Slowed down excavation skill rate
|
||||
Fixed excavation coal drop being too rare
|
||||
|
||||
Version 0.3.4
|
||||
|
||||
Creepers now give double xp for unarmed
|
||||
Iron armor can now be repaired!
|
||||
Fixed bug stopping items from being repaired
|
||||
|
||||
Version 0.3.3
|
||||
|
||||
Yet another herbalism skill gain tweak
|
||||
|
||||
Version 0.3.2
|
||||
|
||||
Changed excavation loot tables to be more rewarding
|
||||
Changed sand to give normal excavation xp instead of double xp
|
||||
Fixed herbalism skill exploit
|
||||
Mobs killed with unarmed now drop loot properly
|
||||
Unarmed xp rate depends on mob (zombies lowest fyi)
|
||||
Huge player crashing bug fix on disarm!
|
||||
|
||||
Version 0.3.1
|
||||
|
||||
Fixed excavation not saving properly
|
||||
Fixed repair using excavation values
|
||||
|
||||
Version 0.3
|
||||
|
||||
Unarmed skill
|
||||
Herbalism skill
|
||||
Excavation skill
|
||||
Many bugfixes (thanks for reporting them!)
|
||||
/<skillname> - Detailed information about skills in game
|
||||
|
||||
Version 0.2.1
|
||||
|
||||
Misc bugfixes
|
||||
|
||||
Version 0.2
|
||||
|
||||
Repair ability added
|
||||
Repair skill added
|
||||
Iron Armor repair temporarily disabled
|
||||
Anvils (Iron Block) added
|
||||
/mcmmo & /mcc added
|
||||
Misc changes to existing commands
|
||||
Misc bug fixes
|
||||
|
||||
Version 0.1
|
||||
|
||||
Releasing my awesome plugin
|
||||
Changelog:
|
||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
|
||||
Version 0.6.2
|
||||
Axes now do critical strikes against farm animals
|
||||
Removed the "Stupidly Long Constructor"
|
||||
Now compatible with the latest CB builds
|
||||
Version 0.6.1
|
||||
Customizable command names
|
||||
Axes can now be modified with /mmoedit
|
||||
Party members are now correctly informed when you leave the party
|
||||
Fixed incorrect commands in /mcc
|
||||
Version 0.5.17
|
||||
|
||||
Changed namespaces to fit bukkits new standard
|
||||
Adjusted excavation proc rates
|
||||
Modified excavation loot tables
|
||||
Added Party Invite System
|
||||
|
||||
Version 0.5.16
|
||||
|
||||
Fixed unarmed not checking for permissions when hitting players
|
||||
|
||||
Version 0.5.15
|
||||
Fixed stone swords not being recognized as swords
|
||||
Fixed /a not working if you were an op but did not have permissions
|
||||
|
||||
Version 0.5.14
|
||||
Added permissions for skills
|
||||
|
||||
Version 0.5.13
|
||||
|
||||
Removed skillgain from succesful parries
|
||||
Repair now refreshed the inventory
|
||||
|
||||
Version 0.5.12
|
||||
|
||||
Fixed being able to hurt party members with the bow and arrow
|
||||
|
||||
Version 0.5.11
|
||||
|
||||
Added /mmoedit command
|
||||
Fixed bug preventing player versus player damage
|
||||
Fixed bug preventing damage from scaling with unarmed & bows
|
||||
Fixed disarm proc making the opponent dupe his/her items
|
||||
Added mcmmo.tools.mmoedit permission
|
||||
Added mcmmo.commands.setmyspawn permission
|
||||
Added totalskill to /stats
|
||||
Changed the look of /stats
|
||||
|
||||
Version 0.5.10
|
||||
|
||||
Fixed trying to set health to an invalid value
|
||||
|
||||
Version 0.5.9
|
||||
|
||||
Fixed duping inventories on death
|
||||
|
||||
Version 0.5.8
|
||||
|
||||
Fixed bug where players inventories would dupe during combat
|
||||
|
||||
Version 0.5.7
|
||||
|
||||
Fixed monsters instant killing players
|
||||
Misc fixes
|
||||
Version 0.5.4
|
||||
|
||||
Changed herbalism skill gain from wheat to be WAAAAY slower
|
||||
|
||||
Version 0.5.3
|
||||
|
||||
Players will now correctly drop their inventories when killed by a monster
|
||||
|
||||
Version 0.5.2
|
||||
|
||||
Fixed MAJOR bug preventing swords skill from gaining through combat
|
||||
|
||||
Version 0.5
|
||||
|
||||
Archery Added
|
||||
Swords Added
|
||||
Acrobatics Added
|
||||
Logging for Party/Admin chat added
|
||||
Fixed whois to show correct values for Excavation
|
||||
Made death messages much much more specific
|
||||
|
||||
Version 0.4.4
|
||||
|
||||
Fixed being able to repair full durability iron tools
|
||||
Fixed herbalism benefits not behaving properly
|
||||
Fixed removing 1 diamond from every stack of diamond when repairing diamond
|
||||
|
||||
Version 0.4.2
|
||||
|
||||
Removed myspawn from the motd
|
||||
|
||||
Version 0.4.1
|
||||
|
||||
Fixed /mcc showing incorrect command for herbalism
|
||||
Changed unarmed skillrate to be much slower than before
|
||||
Modified a few skill descriptions
|
||||
Added permission for /whois
|
||||
Players can now use admin chat without being op as long as they have the correct permission (requires Permissions)
|
||||
|
||||
Version 0.4
|
||||
|
||||
Permissions support
|
||||
Removed OPs having different names than normal players
|
||||
Removed /setspawn & /spawn
|
||||
Slowed down excavation skill rate
|
||||
Fixed excavation coal drop being too rare
|
||||
|
||||
Version 0.3.4
|
||||
|
||||
Creepers now give double xp for unarmed
|
||||
Iron armor can now be repaired!
|
||||
Fixed bug stopping items from being repaired
|
||||
|
||||
Version 0.3.3
|
||||
|
||||
Yet another herbalism skill gain tweak
|
||||
|
||||
Version 0.3.2
|
||||
|
||||
Changed excavation loot tables to be more rewarding
|
||||
Changed sand to give normal excavation xp instead of double xp
|
||||
Fixed herbalism skill exploit
|
||||
Mobs killed with unarmed now drop loot properly
|
||||
Unarmed xp rate depends on mob (zombies lowest fyi)
|
||||
Huge player crashing bug fix on disarm!
|
||||
|
||||
Version 0.3.1
|
||||
|
||||
Fixed excavation not saving properly
|
||||
Fixed repair using excavation values
|
||||
|
||||
Version 0.3
|
||||
|
||||
Unarmed skill
|
||||
Herbalism skill
|
||||
Excavation skill
|
||||
Many bugfixes (thanks for reporting them!)
|
||||
/<skillname> - Detailed information about skills in game
|
||||
|
||||
Version 0.2.1
|
||||
|
||||
Misc bugfixes
|
||||
|
||||
Version 0.2
|
||||
|
||||
Repair ability added
|
||||
Repair skill added
|
||||
Iron Armor repair temporarily disabled
|
||||
Anvils (Iron Block) added
|
||||
/mcmmo & /mcc added
|
||||
Misc changes to existing commands
|
||||
Misc bug fixes
|
||||
|
||||
Version 0.1
|
||||
|
||||
Releasing my awesome plugin
|
||||
|
@ -1,117 +1,117 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class mcBlockListener extends BlockListener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcBlockListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block block;
|
||||
if (event.getBlockReplacedState().getTypeId() == 78) {
|
||||
block = event.getBlockAgainst();
|
||||
}
|
||||
else {
|
||||
block = event.getBlock();
|
||||
}
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
String xyz = x+","+y+","+z;
|
||||
mcConfig.getInstance().addBlockWatch(block);
|
||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
||||
if(block.getTypeId() == 42)
|
||||
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
|
||||
}
|
||||
//put all Block related code here
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
String xyz = x+","+y+","+z;
|
||||
int type = block.getTypeId();
|
||||
Location loc = block.getLocation();
|
||||
int dmg = event.getDamageLevel().getLevel();
|
||||
/*
|
||||
* MINING
|
||||
*/
|
||||
if(dmg == 3 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){
|
||||
if(mcPermissions.getInstance().mining(player))
|
||||
mcm.getInstance().miningBlockCheck(player, block);
|
||||
/*
|
||||
* WOOD CUTTING
|
||||
*/
|
||||
if(block.getTypeId() == 17
|
||||
&& mcPermissions.getInstance().woodcutting(player)){
|
||||
mcUsers.getProfile(player).addwgather(1);
|
||||
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
||||
}
|
||||
mcm.getInstance().simulateSkillUp(player);
|
||||
/*
|
||||
* EXCAVATION
|
||||
*/
|
||||
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
||||
mcm.getInstance().excavationProcCheck(block, player);
|
||||
/*
|
||||
* HERBALISM
|
||||
*/
|
||||
if(!(type == 39 || type == 40 || type == 37 || type == 38)
|
||||
&& mcPermissions.getInstance().herbalism(player));
|
||||
mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
|
||||
/*
|
||||
* EXPLOIT COUNTERMEASURES
|
||||
*/
|
||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
||||
mcConfig.getInstance().addBlockWatch(block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onBlockFlow(BlockFromToEvent event) {
|
||||
//Code borrowed from WorldGuard by sk89q
|
||||
World world = event.getBlock().getWorld();
|
||||
int radius = 1;
|
||||
Block blockFrom = event.getBlock();
|
||||
Block blockTo = event.getToBlock();
|
||||
|
||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||
|
||||
int ox = blockTo.getX();
|
||||
int oy = blockTo.getY();
|
||||
int oz = blockTo.getZ();
|
||||
|
||||
if(blockTo.getTypeId() == 9 || blockTo.getTypeId() == 8){
|
||||
return;
|
||||
}
|
||||
|
||||
for (int cx = -radius; cx <= radius; cx++) {
|
||||
for (int cy = -radius; cy <= radius; cy++) {
|
||||
for (int cz = -radius; cz <= radius; cz++) {
|
||||
Block dirt = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
//If block is dirt
|
||||
if (isWater == true &&
|
||||
dirt.getTypeId() == 13) {
|
||||
//Change
|
||||
dirt.setTypeId(82);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class mcBlockListener extends BlockListener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcBlockListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block block;
|
||||
if (event.getBlockReplacedState().getTypeId() == 78) {
|
||||
block = event.getBlockAgainst();
|
||||
}
|
||||
else {
|
||||
block = event.getBlock();
|
||||
}
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
String xyz = x+","+y+","+z;
|
||||
mcConfig.getInstance().addBlockWatch(block);
|
||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
||||
if(block.getTypeId() == 42)
|
||||
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
|
||||
}
|
||||
//put all Block related code here
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
String xyz = x+","+y+","+z;
|
||||
int type = block.getTypeId();
|
||||
Location loc = block.getLocation();
|
||||
int dmg = event.getDamageLevel().getLevel();
|
||||
/*
|
||||
* MINING
|
||||
*/
|
||||
if(dmg == 3 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){
|
||||
if(mcPermissions.getInstance().mining(player))
|
||||
mcm.getInstance().miningBlockCheck(player, block);
|
||||
/*
|
||||
* WOOD CUTTING
|
||||
*/
|
||||
if(block.getTypeId() == 17
|
||||
&& mcPermissions.getInstance().woodcutting(player)){
|
||||
mcUsers.getProfile(player).addwgather(1);
|
||||
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
||||
}
|
||||
mcm.getInstance().simulateSkillUp(player);
|
||||
/*
|
||||
* EXCAVATION
|
||||
*/
|
||||
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
||||
mcm.getInstance().excavationProcCheck(block, player);
|
||||
/*
|
||||
* HERBALISM
|
||||
*/
|
||||
if(!(type == 39 || type == 40 || type == 37 || type == 38)
|
||||
&& mcPermissions.getInstance().herbalism(player));
|
||||
mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
|
||||
/*
|
||||
* EXPLOIT COUNTERMEASURES
|
||||
*/
|
||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
||||
mcConfig.getInstance().addBlockWatch(block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onBlockFlow(BlockFromToEvent event) {
|
||||
//Code borrowed from WorldGuard by sk89q
|
||||
World world = event.getBlock().getWorld();
|
||||
int radius = 1;
|
||||
Block blockFrom = event.getBlock();
|
||||
Block blockTo = event.getToBlock();
|
||||
|
||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||
|
||||
int ox = blockTo.getX();
|
||||
int oy = blockTo.getY();
|
||||
int oz = blockTo.getZ();
|
||||
|
||||
if(blockTo.getTypeId() == 9 || blockTo.getTypeId() == 8){
|
||||
return;
|
||||
}
|
||||
|
||||
for (int cx = -radius; cx <= radius; cx++) {
|
||||
for (int cy = -radius; cy <= radius; cy++) {
|
||||
for (int cz = -radius; cz <= radius; cz++) {
|
||||
Block dirt = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
//If block is dirt
|
||||
if (isWater == true &&
|
||||
dirt.getTypeId() == 13) {
|
||||
//Change
|
||||
dirt.setTypeId(82);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,56 +1,56 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class mcConfig {
|
||||
private static volatile mcConfig instance;
|
||||
String location = "mcmmo.properties";
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
static ArrayList<String> adminChatList = new ArrayList<String>();
|
||||
static ArrayList<String> coordsWatchList = new ArrayList<String>();
|
||||
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
||||
static ArrayList<String> partyChatList = new ArrayList<String>();
|
||||
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
|
||||
public boolean isCoordsWatched(String xyz) {return coordsWatchList.contains(xyz);}
|
||||
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
|
||||
public void removeCoordsWatch(String xyz) {coordsWatchList.remove(coordsWatchList.indexOf(xyz));}
|
||||
public void addBlockWatch(Block block) {blockWatchList.add(block);}
|
||||
public void addCoordsWatch(String xyz) {coordsWatchList.add(xyz);}
|
||||
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
|
||||
public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);}
|
||||
public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));}
|
||||
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
||||
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
||||
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
||||
|
||||
public static mcConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new mcConfig();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
public void toggleAdminChat(String playerName){
|
||||
if(isAdminToggled(playerName)){
|
||||
removeAdminToggled(playerName);
|
||||
} else {
|
||||
addAdminToggled(playerName);
|
||||
}
|
||||
}
|
||||
public void togglePartyChat(String playerName){
|
||||
if(isPartyToggled(playerName)){
|
||||
removePartyToggled(playerName);
|
||||
} else {
|
||||
addPartyToggled(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class mcConfig {
|
||||
private static volatile mcConfig instance;
|
||||
String location = "mcmmo.properties";
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
static ArrayList<String> adminChatList = new ArrayList<String>();
|
||||
static ArrayList<String> coordsWatchList = new ArrayList<String>();
|
||||
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
||||
static ArrayList<String> partyChatList = new ArrayList<String>();
|
||||
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
|
||||
public boolean isCoordsWatched(String xyz) {return coordsWatchList.contains(xyz);}
|
||||
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
|
||||
public void removeCoordsWatch(String xyz) {coordsWatchList.remove(coordsWatchList.indexOf(xyz));}
|
||||
public void addBlockWatch(Block block) {blockWatchList.add(block);}
|
||||
public void addCoordsWatch(String xyz) {coordsWatchList.add(xyz);}
|
||||
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
|
||||
public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);}
|
||||
public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));}
|
||||
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
||||
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
||||
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
||||
|
||||
public static mcConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new mcConfig();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
public void toggleAdminChat(String playerName){
|
||||
if(isAdminToggled(playerName)){
|
||||
removeAdminToggled(playerName);
|
||||
} else {
|
||||
addAdminToggled(playerName);
|
||||
}
|
||||
}
|
||||
public void togglePartyChat(String playerName){
|
||||
if(isPartyToggled(playerName)){
|
||||
removePartyToggled(playerName);
|
||||
} else {
|
||||
addPartyToggled(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,365 +1,131 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class mcEntityListener extends EntityListener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcEntityListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity x = event.getEntity(); //Defender
|
||||
Entity y = event.getDamager(); //Attacker
|
||||
/*
|
||||
* IF DEFENDER IS PLAYER
|
||||
*/
|
||||
if(x instanceof Player){
|
||||
Player defender = (Player)x;
|
||||
/*
|
||||
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
||||
*/
|
||||
mcm.getInstance().parryCheck(defender, event, y);
|
||||
/*
|
||||
* PLAYER DEATH BY MONSTER MESSAGE CHECK, CHECKS TO SEE IF TO REPORT THE DEATH OR NOT
|
||||
*/
|
||||
mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
|
||||
/*
|
||||
* CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS
|
||||
* MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
|
||||
*/
|
||||
|
||||
}
|
||||
/*
|
||||
* IF ATTACKER IS PLAYER
|
||||
*/
|
||||
if(y instanceof Player){
|
||||
int type = ((Player) y).getItemInHand().getTypeId();
|
||||
Player attacker = (Player)y;
|
||||
/*
|
||||
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
|
||||
*/
|
||||
mcm.getInstance().playerVersusMonsterChecks(event, attacker, x, type);
|
||||
/*
|
||||
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
|
||||
*/
|
||||
mcm.getInstance().playerVersusSquidChecks(event, attacker, x, type);
|
||||
/*
|
||||
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
|
||||
*/
|
||||
mcm.getInstance().playerVersusPlayerChecks(x, attacker, event, plugin);
|
||||
/*
|
||||
* Player versus Animals checks, these checks handle any skill modifiers or procs
|
||||
*/
|
||||
mcm.getInstance().playerVersusAnimalsChecks(x, attacker, event, type);
|
||||
}
|
||||
}
|
||||
public boolean isBow(ItemStack is){
|
||||
if (is.getTypeId() == 261){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
|
||||
Entity y = event.getDamager();
|
||||
Entity x = event.getEntity();
|
||||
/*
|
||||
* Defender is player
|
||||
*/
|
||||
if(y instanceof Player){
|
||||
Player attacker = (Player)y;
|
||||
/*
|
||||
* DEBUG MESSAGE
|
||||
*/
|
||||
//attacker.sendMessage(event.getProjectile().toString());
|
||||
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
|
||||
/*
|
||||
* Defender is Monster
|
||||
*/
|
||||
if(x instanceof Monster){
|
||||
Monster defender = (Monster)x;
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
||||
if(defender.getHealth() <= 0)
|
||||
mcm.getInstance().simulateNaturalDrops(defender);
|
||||
//XP
|
||||
if(Math.random() * 10 > 7){
|
||||
mcUsers.getProfile(attacker).skillUpArchery(1);
|
||||
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by 1. Total ("+mcUsers.getProfile(attacker).getArchery()+")");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Defender is Animals
|
||||
*/
|
||||
if(x instanceof Animals){
|
||||
Animals defender = (Animals)x;
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
||||
if(defender.getHealth() <= 0)
|
||||
mcm.getInstance().simulateNaturalDrops(defender);
|
||||
}
|
||||
/*
|
||||
* Defender is Squid
|
||||
*/
|
||||
if(x instanceof Squid){
|
||||
Squid defender = (Squid)x;
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
||||
if(defender.getHealth() <= 0)
|
||||
mcm.getInstance().simulateNaturalDrops(defender);
|
||||
}
|
||||
/*
|
||||
* Attacker is Player
|
||||
*/
|
||||
if(x instanceof Player){
|
||||
if(mcLoadProperties.pvp == false){
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
Player defender = (Player)x;
|
||||
/*
|
||||
* Stuff for the daze proc
|
||||
*/
|
||||
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
||||
if(mcm.getInstance().inSameParty(defender, attacker)){
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Location loc = defender.getLocation();
|
||||
if(Math.random() * 10 > 5){
|
||||
loc.setPitch(90);
|
||||
} else {
|
||||
loc.setPitch(-90);
|
||||
}
|
||||
/*
|
||||
* Check the proc
|
||||
*/
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 300 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
|
||||
if(Math.random() * 10 > 7){
|
||||
defender.teleportTo(loc);
|
||||
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
|
||||
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 600){
|
||||
if(Math.random() * 10 > 4){
|
||||
defender.teleportTo(loc);
|
||||
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
|
||||
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
|
||||
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
|
||||
if(defender.getHealth() >= 0){
|
||||
if(mcUsers.getProfile(defender).isDead())
|
||||
return;
|
||||
if(defender.getHealth() <= 0){
|
||||
mcUsers.getProfile(defender).setDead(true);
|
||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
||||
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with an arrow.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mcUsers.getProfile(defender).isDead())
|
||||
return;
|
||||
if(defender.getHealth() - event.getDamage() <= 0){
|
||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
||||
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with the bow and arrow.");
|
||||
mcUsers.getProfile(defender).setDead(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity x = event.getEntity();
|
||||
if(x instanceof Player){
|
||||
Player player = (Player)x;
|
||||
DamageCause type = event.getCause();
|
||||
Location loc = player.getLocation();
|
||||
int xx = loc.getBlockX();
|
||||
int y = loc.getBlockY();
|
||||
int z = loc.getBlockZ();
|
||||
if(type == DamageCause.FALL){
|
||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50
|
||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 250
|
||||
&& mcPermissions.getInstance().acrobatics(player)){
|
||||
if(Math.random() * 10 > 8){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage("**ROLLED**");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250
|
||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450
|
||||
&& mcPermissions.getInstance().acrobatics(player)){
|
||||
if(Math.random() * 10 > 6){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage("**ROLLED**");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450
|
||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750
|
||||
&& mcPermissions.getInstance().acrobatics(player)){
|
||||
if(Math.random() * 10 > 4){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage("**ROLLED**");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750
|
||||
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950
|
||||
&& mcPermissions.getInstance().acrobatics(player)){
|
||||
if(Math.random() * 10 > 2){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage("**BARREL ROLLED**");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950
|
||||
&& mcPermissions.getInstance().acrobatics(player)){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage("**ROLLED... LIKE A BOSS**");
|
||||
return;
|
||||
}
|
||||
if(player.getHealth() - event.getDamage() <= 0)
|
||||
return;
|
||||
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
|
||||
&& mcPermissions.getInstance().acrobatics(player)){
|
||||
if(event.getDamage() >= 2 && event.getDamage() < 6){
|
||||
mcUsers.getProfile(player).skillUpAcrobatics(1);
|
||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 1. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
||||
}
|
||||
if(event.getDamage() >= 6 && event.getDamage() < 19){
|
||||
mcUsers.getProfile(player).skillUpAcrobatics(2);
|
||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 2. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
||||
}
|
||||
if(event.getDamage() >= 19){
|
||||
mcUsers.getProfile(player).skillUpAcrobatics(3);
|
||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 3. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
||||
}
|
||||
}
|
||||
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
|
||||
if(player.getHealth() - event.getDamage() <= 0){
|
||||
if(mcUsers.getProfile(player).isDead())
|
||||
return;
|
||||
mcUsers.getProfile(player).setDead(true);
|
||||
for(Player bidoof : plugin.getServer().getOnlinePlayers()){
|
||||
bidoof.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.DARK_RED+"fallen "+ChatColor.GRAY+"to death.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(type == DamageCause.DROWNING){
|
||||
if(mcUsers.getProfile(player).isDead())
|
||||
return;
|
||||
if(player.getHealth() - event.getDamage() <= 0){
|
||||
mcUsers.getProfile(player).setDead(true);
|
||||
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
|
||||
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.AQUA+"drowned.");
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(type == DamageCause.FIRE || type == DamageCause.FIRE_TICK){
|
||||
if(mcUsers.getProfile(player).isDead())
|
||||
return;
|
||||
if(player.getHealth() - event.getDamage() <= 0){
|
||||
mcUsers.getProfile(player).setDead(true);
|
||||
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
|
||||
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.RED+"burned "+ChatColor.GRAY+"to death.");
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if(type == DamageCause.LAVA){
|
||||
if(mcUsers.getProfile(player).isDead())
|
||||
return;
|
||||
if(player.getHealth() - event.getDamage() <= 0){
|
||||
mcUsers.getProfile(player).setDead(true);
|
||||
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
|
||||
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.RED+"melted "+ChatColor.GRAY+".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
Entity x = event.getEntity();
|
||||
if(x instanceof Player){
|
||||
Player player = (Player)x;
|
||||
if(mcUsers.getProfile(player).isDead()){
|
||||
mcUsers.getProfile(player).setDead(false);
|
||||
return;
|
||||
}
|
||||
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
||||
derp.sendMessage(ChatColor.GRAY+player.getName()+" has died.");
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean isPlayer(Entity entity){
|
||||
if (entity instanceof Player) {
|
||||
return true;
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class mcEntityListener extends EntityListener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcEntityListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public boolean isBow(ItemStack is){
|
||||
if (is.getTypeId() == 261){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity x = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
/*
|
||||
* ACROBATICS
|
||||
*/
|
||||
if(x instanceof Player){
|
||||
Player player = (Player)x;
|
||||
Location loc = player.getLocation();
|
||||
int xx = loc.getBlockX();
|
||||
int y = loc.getBlockY();
|
||||
int z = loc.getBlockZ();
|
||||
if(type == DamageCause.FALL){
|
||||
mcm.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* ARCHERY CHECKS
|
||||
*/
|
||||
if(event instanceof EntityDamageByProjectileEvent){
|
||||
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
|
||||
mcm.getInstance().archeryCheck(c);
|
||||
}
|
||||
/*
|
||||
* Entity Damage by Entity checks
|
||||
*/
|
||||
if(event instanceof EntityDamageByEntityEvent){
|
||||
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
|
||||
Entity e = eventb.getEntity(); //Defender
|
||||
Entity f = eventb.getDamager(); //Attacker
|
||||
/*
|
||||
* IF DEFENDER IS PLAYER
|
||||
*/
|
||||
if(e instanceof Player){
|
||||
Player defender = (Player)e;
|
||||
/*
|
||||
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
||||
*/
|
||||
mcm.getInstance().parryCheck(defender, eventb, f);
|
||||
/*
|
||||
* PLAYER DEATH BY MONSTER MESSAGE CHECK, CHECKS TO SEE IF TO REPORT THE DEATH OR NOT
|
||||
*/
|
||||
//mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
|
||||
/*
|
||||
* CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS
|
||||
* MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
|
||||
*/
|
||||
|
||||
}
|
||||
/*
|
||||
* IF ATTACKER IS PLAYER
|
||||
*/
|
||||
if(f instanceof Player){
|
||||
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
|
||||
int typeid = ((Player) f).getItemInHand().getTypeId();
|
||||
Player attacker = (Player)f;
|
||||
/*
|
||||
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
|
||||
*/
|
||||
mcm.getInstance().playerVersusMonsterChecks(eventb, attacker, e, typeid);
|
||||
/*
|
||||
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
|
||||
*/
|
||||
mcm.getInstance().playerVersusSquidChecks(eventb, attacker, e, typeid);
|
||||
/*
|
||||
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
|
||||
*/
|
||||
mcm.getInstance().playerVersusPlayerChecks(e, attacker, eventb, plugin);
|
||||
/*
|
||||
* Player versus Animals checks, these checks handle any skill modifiers or procs
|
||||
*/
|
||||
mcm.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
Entity x = event.getEntity();
|
||||
if(x instanceof Player){
|
||||
Player player = (Player)x;
|
||||
if(mcUsers.getProfile(player).isDead()){
|
||||
mcUsers.getProfile(player).setDead(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean isPlayer(Entity entity){
|
||||
if (entity instanceof Player) {
|
||||
return true;
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,17 @@ package com.gmail.nossr50;
|
||||
|
||||
public class mcLoadProperties {
|
||||
public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal;
|
||||
public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept;
|
||||
|
||||
public static void loadMain(){
|
||||
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
|
||||
mcProperties properties = new mcProperties(propertiesFile);
|
||||
properties.load();
|
||||
|
||||
//Grab properties stuff here
|
||||
|
||||
/*
|
||||
* EXCAVATION LOOT TOGGLES
|
||||
*/
|
||||
glowstone = properties.getBoolean("glowstone", true);
|
||||
pvp = properties.getBoolean("pvp", true);
|
||||
eggs = properties.getBoolean("eggs", true);
|
||||
@ -20,7 +24,21 @@ public class mcLoadProperties {
|
||||
sulphur = properties.getBoolean("sulphur", true);
|
||||
netherrack = properties.getBoolean("netherrack", true);
|
||||
bones = properties.getBoolean("bones", true);
|
||||
properties.save("==McMMO Configuration==");
|
||||
/*
|
||||
* CUSTOM COMMANDS
|
||||
*/
|
||||
mcmmo = properties.getString("mcmmo", "mcmmo");
|
||||
mcc = properties.getString("mcc", "mcc");
|
||||
stats = properties.getString("stats", "stats");
|
||||
mmoedit = properties.getString("mmoedit", "mmoedit");
|
||||
ptp = properties.getString("ptp", "ptp");
|
||||
party = properties.getString("party", "party");
|
||||
myspawn = properties.getString("myspawn", "myspawn");
|
||||
setmyspawn = properties.getString("setmyspawn", "setmyspawn");
|
||||
whois = properties.getString("whois", "whois");
|
||||
invite = properties.getString("invite", "invite");
|
||||
accept = properties.getString("accept", "accept");
|
||||
properties.save("==McMMO Configuration==\r\nYou can turn off excavation loot tables by turning the option to false\r\nYou can customize mcMMOs command names by modifying them here as well\r\nThis is an early version of the configuration file, eventually you'll be able to customize messages from mcMMO and XP gains");
|
||||
//herp derp
|
||||
}
|
||||
}
|
@ -1,125 +1,127 @@
|
||||
package com.gmail.nossr50;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.nijiko.Messaging;
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijiko.permissions.Control;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
static String maindirectory = "mcMMO/";
|
||||
static File Properties = new File(maindirectory + "mcmmo.properties");
|
||||
public static final Logger log = Logger.getLogger("Minecraft");
|
||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
||||
private final String name = "mcMMO";
|
||||
public static PermissionHandler PermissionsHandler = null;
|
||||
private Permissions permissions;
|
||||
|
||||
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
//Make the directory if it does not exist
|
||||
new File(maindirectory).mkdir();
|
||||
//Make the file if it does not exist
|
||||
if(!Properties.exists()){
|
||||
try {
|
||||
Properties.createNewFile();
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(Properties);
|
||||
writer.append("#Turn this setting to false to disable pvp interactions completely");
|
||||
writer.append("pvp=true");
|
||||
writer.append("#Excavation Loot Toggles");
|
||||
writer.append("eggs=true");
|
||||
writer.append("apples=true");
|
||||
writer.append("cake=true");
|
||||
writer.append("music=true");
|
||||
writer.append("diamond=true");
|
||||
writer.append("glowstone=true");
|
||||
writer.append("slowsand=true");
|
||||
writer.append("netherrack=true");
|
||||
writer.append("bones=true");
|
||||
writer.append("sulphur=true");
|
||||
writer.append("coal=true");
|
||||
writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n");
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
|
||||
} finally {
|
||||
try {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//Load the file
|
||||
mcLoadProperties.loadMain();
|
||||
mcUsers.getInstance().loadUsers();
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
|
||||
//Displays a message when plugin is loaded
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
mcPermissions.initialize(getServer());
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
}
|
||||
public void setupPermissions() {
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
if(this.PermissionsHandler == null) {
|
||||
if(test != null) {
|
||||
this.PermissionsHandler = ((Permissions)test).getHandler();
|
||||
} else {
|
||||
log.info(Messaging.bracketize(name) + " Permission system not enabled. Disabling plugin.");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Permissions getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void onDisable() {
|
||||
System.out.println("mcMMO was disabled.");
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.nijiko.Messaging;
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijiko.permissions.Control;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
static String maindirectory = "mcMMO/";
|
||||
static File Properties = new File(maindirectory + "mcmmo.properties");
|
||||
public static final Logger log = Logger.getLogger("Minecraft");
|
||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
||||
private final String name = "mcMMO";
|
||||
public static PermissionHandler PermissionsHandler = null;
|
||||
private Permissions permissions;
|
||||
|
||||
/*
|
||||
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||
}
|
||||
*/
|
||||
//herp
|
||||
public void onEnable() {
|
||||
//Make the directory if it does not exist
|
||||
new File(maindirectory).mkdir();
|
||||
//Make the file if it does not exist
|
||||
if(!Properties.exists()){
|
||||
try {
|
||||
Properties.createNewFile();
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(Properties);
|
||||
writer.append("#Turn this setting to false to disable pvp interactions completely");
|
||||
writer.append("pvp=true");
|
||||
writer.append("#Excavation Loot Toggles");
|
||||
writer.append("eggs=true");
|
||||
writer.append("apples=true");
|
||||
writer.append("cake=true");
|
||||
writer.append("music=true");
|
||||
writer.append("diamond=true");
|
||||
writer.append("glowstone=true");
|
||||
writer.append("slowsand=true");
|
||||
writer.append("netherrack=true");
|
||||
writer.append("bones=true");
|
||||
writer.append("sulphur=true");
|
||||
writer.append("coal=true");
|
||||
writer.append("mcmmo=mcmmo");
|
||||
writer.append("mcc=mcc");
|
||||
writer.append("stats=stats");
|
||||
writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n");
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
|
||||
} finally {
|
||||
try {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//Load the file
|
||||
mcLoadProperties.loadMain();
|
||||
mcUsers.getInstance().loadUsers();
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
|
||||
//Displays a message when plugin is loaded
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
mcPermissions.initialize(getServer());
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
}
|
||||
public void setupPermissions() {
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
if(this.PermissionsHandler == null) {
|
||||
if(test != null) {
|
||||
this.PermissionsHandler = ((Permissions)test).getHandler();
|
||||
} else {
|
||||
log.info(Messaging.bracketize(name) + " Permission system not enabled. Disabling plugin.");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Permissions getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
public void onDisable() {
|
||||
System.out.println("mcMMO was disabled.");
|
||||
}
|
||||
}
|
||||
|
@ -1,171 +1,171 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
public class mcPermissions {
|
||||
//Thanks to myWarp source code for helping me figure this shit out!
|
||||
private static Permissions permissionsPlugin;
|
||||
private static boolean permissionsEnabled = false;
|
||||
private static volatile mcPermissions instance;
|
||||
|
||||
public static void initialize(Server server) {
|
||||
Plugin test = server.getPluginManager().getPlugin("Permissions");
|
||||
if (test != null) {
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
permissionsPlugin = ((Permissions) test);
|
||||
permissionsEnabled = true;
|
||||
log.log(Level.INFO, "[mcMMO] Permissions enabled.");
|
||||
} else {
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
log.log(Level.SEVERE, "[mcMMO] Permissions isn't loaded, there are no restrictions.");
|
||||
}
|
||||
}
|
||||
private boolean permission(Player player, String string) {
|
||||
return permissionsPlugin.Security.permission(player, string);
|
||||
}
|
||||
public boolean mmoedit(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.tools.mmoedit");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean motd(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.motd");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean mySpawn(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.myspawn");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean setMySpawn(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.setmyspawn");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean partyChat(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.partychat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean partyTeleport(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.ptp");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean whois(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.whois");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean party(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.party");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean adminChat(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.adminchat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public static mcPermissions getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new mcPermissions();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
public boolean mining(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.mining");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean woodcutting(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.woodcutting");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean repair(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.repair");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean unarmed(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.unarmed");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean archery(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.archery");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean herbalism(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.herbalism");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean excavation(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.excavation");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean swords(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.swords");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean axes(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.axes");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean acrobatics(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.acrobatics");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
public class mcPermissions {
|
||||
//Thanks to myWarp source code for helping me figure this shit out!
|
||||
private static Permissions permissionsPlugin;
|
||||
private static boolean permissionsEnabled = false;
|
||||
private static volatile mcPermissions instance;
|
||||
|
||||
public static void initialize(Server server) {
|
||||
Plugin test = server.getPluginManager().getPlugin("Permissions");
|
||||
if (test != null) {
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
permissionsPlugin = ((Permissions) test);
|
||||
permissionsEnabled = true;
|
||||
log.log(Level.INFO, "[mcMMO] Permissions enabled.");
|
||||
} else {
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
log.log(Level.SEVERE, "[mcMMO] Permissions isn't loaded, there are no restrictions.");
|
||||
}
|
||||
}
|
||||
private boolean permission(Player player, String string) {
|
||||
return permissionsPlugin.Security.permission(player, string);
|
||||
}
|
||||
public boolean mmoedit(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.tools.mmoedit");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean motd(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.motd");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean mySpawn(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.myspawn");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean setMySpawn(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.setmyspawn");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean partyChat(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.partychat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean partyTeleport(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.ptp");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean whois(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.whois");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean party(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.party");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean adminChat(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.adminchat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public static mcPermissions getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new mcPermissions();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
public boolean mining(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.mining");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean woodcutting(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.woodcutting");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean repair(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.repair");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean unarmed(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.unarmed");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean archery(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.archery");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean herbalism(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.herbalism");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean excavation(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.excavation");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean swords(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.swords");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean axes(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.axes");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean acrobatics(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.acrobatics");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,375 +1,377 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerItemEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
public class mcPlayerListener extends PlayerListener {
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
public Location spawn = null;
|
||||
private mcMMO plugin;
|
||||
|
||||
public mcPlayerListener(mcMMO instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(mcPermissions.getInstance().mySpawn(player)){
|
||||
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
||||
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
|
||||
}
|
||||
//HELLO CODE PEAKERS!
|
||||
}
|
||||
public Player[] getPlayersOnline() {
|
||||
return plugin.getServer().getOnlinePlayers();
|
||||
}
|
||||
public boolean isPlayer(String playerName){
|
||||
for(Player herp : getPlayersOnline()){
|
||||
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Player getPlayer(String playerName){
|
||||
for(Player herp : getPlayersOnline()){
|
||||
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
||||
return herp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public int partyCount(Player player){
|
||||
int x = 0;
|
||||
for(Player hurrdurr: getPlayersOnline()){
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
||||
x++;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
public void informPartyMembers(Player player){
|
||||
int x = 0;
|
||||
for(Player p : getPlayersOnline()){
|
||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party");
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void informPartyMembersQuit(Player player){
|
||||
int x = 0;
|
||||
for(Player p : getPlayersOnline()){
|
||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party");
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
mcUsers.addUser(player);
|
||||
if(mcPermissions.getInstance().motd(player)){
|
||||
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type "+ChatColor.YELLOW+"/mcmmo "+ChatColor.BLUE+ "for help.");
|
||||
}
|
||||
}
|
||||
//Check if string is a player
|
||||
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
Block block = event.getBlockClicked();
|
||||
Player player = event.getPlayer();
|
||||
ItemStack is = player.getItemInHand();
|
||||
if(mcPermissions.getInstance().herbalism(player)){
|
||||
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||
mcm.getInstance().breadCheck(player, is);
|
||||
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||
mcm.getInstance().stewCheck(player, is);
|
||||
}
|
||||
if(mcPermissions.getInstance().repair(player)){
|
||||
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
||||
mcm.getInstance().repairCheck(player, is, block);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String[] split = event.getMessage().split(" ");
|
||||
String playerName = player.getName();
|
||||
//Check if the command is an mcMMO related help command
|
||||
mcm.getInstance().mcmmoHelpCheck(split, player, event);
|
||||
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/mmoedit")){
|
||||
if(split.length < 3){
|
||||
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
|
||||
return;
|
||||
}
|
||||
if(split.length == 4){
|
||||
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcm.getInstance().isSkill(split[2])){
|
||||
int newvalue = Integer.valueOf(split[3]);
|
||||
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]);
|
||||
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
||||
}
|
||||
}
|
||||
else if(split.length == 3){
|
||||
if(mcm.getInstance().isInt(split[2]) && mcm.getInstance().isSkill(split[1])){
|
||||
int newvalue = Integer.valueOf(split[2]);
|
||||
mcUsers.getProfile(player).modifyskill(newvalue, split[1]);
|
||||
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
|
||||
event.setCancelled(true);
|
||||
if(!mcPermissions.getInstance().partyTeleport(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
if(split.length < 2){
|
||||
player.sendMessage(ChatColor.RED+"Usage is /ptp <playername>");
|
||||
return;
|
||||
}
|
||||
if(isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
||||
player.teleportTo(target);
|
||||
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
||||
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/whois")){
|
||||
event.setCancelled(true);
|
||||
if(split.length < 2){
|
||||
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
|
||||
return;
|
||||
}
|
||||
//if split[1] is a player
|
||||
if(isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
double x,y,z;
|
||||
x = target.getLocation().getX();
|
||||
y = target.getLocation().getY();
|
||||
z = target.getLocation().getZ();
|
||||
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
|
||||
player.sendMessage(target.getName());
|
||||
if(mcUsers.getProfile(target).inParty())
|
||||
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty());
|
||||
player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
|
||||
player.sendMessage("OP: " + target.isOp());
|
||||
player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~");
|
||||
player.sendMessage("Mining Skill: "+mcUsers.getProfile(target).getMining());
|
||||
player.sendMessage("Repair Skill: "+mcUsers.getProfile(target).getRepair());
|
||||
player.sendMessage("Woodcutting Skill: "+mcUsers.getProfile(target).getWoodCutting());
|
||||
player.sendMessage("Unarmed Skill: "+mcUsers.getProfile(target).getUnarmed());
|
||||
player.sendMessage("Herbalism Skill: "+mcUsers.getProfile(target).getHerbalism());
|
||||
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
|
||||
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
|
||||
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords());
|
||||
player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes());
|
||||
player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics());
|
||||
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
||||
player.sendMessage("X: "+x);
|
||||
player.sendMessage("Y: "+y);
|
||||
player.sendMessage("Z: "+z);
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/setmyspawn")){
|
||||
if(!mcPermissions.getInstance().setMySpawn(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
double x = player.getLocation().getX();
|
||||
double y = player.getLocation().getY();
|
||||
double z = player.getLocation().getZ();
|
||||
mcUsers.getProfile(player).setMySpawn(x, y, z);
|
||||
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/stats")){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
|
||||
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining());
|
||||
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair());
|
||||
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting());
|
||||
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed());
|
||||
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism());
|
||||
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
|
||||
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
|
||||
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords());
|
||||
player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
|
||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics());
|
||||
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
|
||||
(mcUsers.getProfile(player).getAcrobaticsInt()+
|
||||
mcUsers.getProfile(player).getArcheryInt()+
|
||||
mcUsers.getProfile(player).getAxesInt()+
|
||||
mcUsers.getProfile(player).getExcavationInt()+
|
||||
mcUsers.getProfile(player).getHerbalismInt()+
|
||||
mcUsers.getProfile(player).getMiningInt()+
|
||||
mcUsers.getProfile(player).getRepairInt()+
|
||||
mcUsers.getProfile(player).getSwordsInt()+
|
||||
mcUsers.getProfile(player).getUnarmedInt()+
|
||||
mcUsers.getProfile(player).getWoodCuttingint())
|
||||
);
|
||||
}
|
||||
//Invite Command
|
||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/invite")){
|
||||
if(!mcUsers.getProfile(player).inParty()){
|
||||
player.sendMessage(ChatColor.RED+"You are not in a party.");
|
||||
return;
|
||||
}
|
||||
if(split.length < 2){
|
||||
player.sendMessage(ChatColor.RED+"Usage is /invite <playername");
|
||||
return;
|
||||
}
|
||||
if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty());
|
||||
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
|
||||
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
|
||||
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/accept"+ChatColor.YELLOW+" to accept the invite");
|
||||
}
|
||||
}
|
||||
//Accept invite
|
||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/accept")){
|
||||
if(mcUsers.getProfile(player).hasPartyInvite()){
|
||||
if(mcUsers.getProfile(player).inParty()){
|
||||
informPartyMembersQuit(player);
|
||||
}
|
||||
mcUsers.getProfile(player).acceptInvite();
|
||||
informPartyMembers(player);
|
||||
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED+"You have no invites at this time");
|
||||
}
|
||||
}
|
||||
//Party command
|
||||
if(split[0].equalsIgnoreCase("/party")){
|
||||
if(!mcPermissions.getInstance().party(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
|
||||
player.sendMessage("Proper usage is /party <name> or 'q' to quit");
|
||||
return;
|
||||
}
|
||||
if(split.length == 1 && mcUsers.getProfile(player).inParty()){
|
||||
String tempList = "";
|
||||
int x = 0;
|
||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){
|
||||
if(p != null && x+1 >= partyCount(player)){
|
||||
tempList+= p.getName();
|
||||
x++;
|
||||
}
|
||||
if(p != null && x < partyCount(player)){
|
||||
tempList+= p.getName() +", ";
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN+"You are in party \""+mcUsers.getProfile(player).getParty()+"\"");
|
||||
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
|
||||
}
|
||||
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){
|
||||
informPartyMembersQuit(player);
|
||||
mcUsers.getProfile(player).removeParty();
|
||||
player.sendMessage(ChatColor.RED + "You have left that party");
|
||||
return;
|
||||
}
|
||||
if(split.length >= 2){
|
||||
mcUsers.getProfile(player).setParty(split[1]);
|
||||
player.sendMessage("Joined Party: " + split[1]);
|
||||
informPartyMembers(player);
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/p")){
|
||||
if(!mcPermissions.getInstance().party(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(mcConfig.getInstance().isAdminToggled(player.getName()))
|
||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||
mcConfig.getInstance().togglePartyChat(playerName);
|
||||
if(mcConfig.getInstance().isPartyToggled(playerName)){
|
||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/a") && (player.isOp() || mcPermissions.getInstance().adminChat(player))){
|
||||
if(!mcPermissions.getInstance().adminChat(player) && !player.isOp()){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(mcConfig.getInstance().isPartyToggled(player.getName()))
|
||||
mcConfig.getInstance().togglePartyChat(playerName);
|
||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||
if(mcConfig.getInstance().isAdminToggled(playerName)){
|
||||
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/myspawn")){
|
||||
if(!mcPermissions.getInstance().mySpawn(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(mcUsers.getProfile(player).getMySpawn(player) != null){
|
||||
player.getInventory().clear();
|
||||
player.setHealth(20);
|
||||
player.teleportTo(mcUsers.getProfile(player).getMySpawn(player));
|
||||
player.sendMessage("Inventory cleared & health restored");
|
||||
}else{
|
||||
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String[] split = event.getMessage().split(" ");
|
||||
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
||||
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
||||
if(mcConfig.getInstance().isPartyToggled(player.getName())){
|
||||
event.setCancelled(true);
|
||||
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||
if(mcUsers.getProfile(herp).inParty()){
|
||||
if(mcm.getInstance().inSameParty(herp, player)){
|
||||
herp.sendMessage(x+event.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if((player.isOp() || mcPermissions.getInstance().adminChat(player))
|
||||
&& mcConfig.getInstance().isAdminToggled(player.getName())){
|
||||
log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage());
|
||||
event.setCancelled(true);
|
||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||
if(herp.isOp()){
|
||||
herp.sendMessage(y+event.getMessage());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerItemEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
public class mcPlayerListener extends PlayerListener {
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
public Location spawn = null;
|
||||
private mcMMO plugin;
|
||||
|
||||
public mcPlayerListener(mcMMO instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(mcPermissions.getInstance().mySpawn(player)){
|
||||
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
||||
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
|
||||
}
|
||||
//HELLO CODE PEAKERS!
|
||||
}
|
||||
public Player[] getPlayersOnline() {
|
||||
return plugin.getServer().getOnlinePlayers();
|
||||
}
|
||||
public boolean isPlayer(String playerName){
|
||||
for(Player herp : getPlayersOnline()){
|
||||
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Player getPlayer(String playerName){
|
||||
for(Player herp : getPlayersOnline()){
|
||||
if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
|
||||
return herp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public int partyCount(Player player){
|
||||
int x = 0;
|
||||
for(Player hurrdurr: getPlayersOnline()){
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
||||
x++;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
public void informPartyMembers(Player player){
|
||||
int x = 0;
|
||||
for(Player p : getPlayersOnline()){
|
||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party");
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void informPartyMembersQuit(Player player){
|
||||
int x = 0;
|
||||
for(Player p : getPlayersOnline()){
|
||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party");
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
mcUsers.addUser(player);
|
||||
if(mcPermissions.getInstance().motd(player)){
|
||||
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
|
||||
}
|
||||
}
|
||||
//Check if string is a player
|
||||
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
Block block = event.getBlockClicked();
|
||||
Player player = event.getPlayer();
|
||||
ItemStack is = player.getItemInHand();
|
||||
if(mcPermissions.getInstance().herbalism(player)){
|
||||
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||
mcm.getInstance().breadCheck(player, is);
|
||||
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||
mcm.getInstance().stewCheck(player, is);
|
||||
}
|
||||
if(mcPermissions.getInstance().repair(player)){
|
||||
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
||||
mcm.getInstance().repairCheck(player, is, block);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String[] split = event.getMessage().split(" ");
|
||||
String playerName = player.getName();
|
||||
//Check if the command is an mcMMO related help command
|
||||
mcm.getInstance().mcmmoHelpCheck(split, player, event);
|
||||
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
|
||||
if(split.length < 3){
|
||||
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue");
|
||||
return;
|
||||
}
|
||||
if(split.length == 4){
|
||||
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcm.getInstance().isSkill(split[2])){
|
||||
int newvalue = Integer.valueOf(split[3]);
|
||||
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]);
|
||||
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
||||
}
|
||||
}
|
||||
else if(split.length == 3){
|
||||
if(mcm.getInstance().isInt(split[2]) && mcm.getInstance().isSkill(split[1])){
|
||||
int newvalue = Integer.valueOf(split[2]);
|
||||
mcUsers.getProfile(player).modifyskill(newvalue, split[1]);
|
||||
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
}
|
||||
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){
|
||||
event.setCancelled(true);
|
||||
if(!mcPermissions.getInstance().partyTeleport(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
if(split.length < 2){
|
||||
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.ptp+" <playername>");
|
||||
return;
|
||||
}
|
||||
if(isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
||||
player.teleportTo(target);
|
||||
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
||||
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/"+mcLoadProperties.whois)){
|
||||
event.setCancelled(true);
|
||||
if(split.length < 2){
|
||||
player.sendMessage(ChatColor.RED + "Proper usage is /"+mcLoadProperties.whois+" <playername>");
|
||||
return;
|
||||
}
|
||||
//if split[1] is a player
|
||||
if(isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
double x,y,z;
|
||||
x = target.getLocation().getX();
|
||||
y = target.getLocation().getY();
|
||||
z = target.getLocation().getZ();
|
||||
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
|
||||
player.sendMessage(target.getName());
|
||||
if(mcUsers.getProfile(target).inParty())
|
||||
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty());
|
||||
player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
|
||||
player.sendMessage("OP: " + target.isOp());
|
||||
player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~");
|
||||
player.sendMessage("Mining Skill: "+mcUsers.getProfile(target).getMining());
|
||||
player.sendMessage("Repair Skill: "+mcUsers.getProfile(target).getRepair());
|
||||
player.sendMessage("Woodcutting Skill: "+mcUsers.getProfile(target).getWoodCutting());
|
||||
player.sendMessage("Unarmed Skill: "+mcUsers.getProfile(target).getUnarmed());
|
||||
player.sendMessage("Herbalism Skill: "+mcUsers.getProfile(target).getHerbalism());
|
||||
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
|
||||
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
|
||||
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords());
|
||||
player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes());
|
||||
player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics());
|
||||
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
||||
player.sendMessage("X: "+x);
|
||||
player.sendMessage("Y: "+y);
|
||||
player.sendMessage("Z: "+z);
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){
|
||||
if(!mcPermissions.getInstance().setMySpawn(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
double x = player.getLocation().getX();
|
||||
double y = player.getLocation().getY();
|
||||
double z = player.getLocation().getZ();
|
||||
mcUsers.getProfile(player).setMySpawn(x, y, z);
|
||||
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
|
||||
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining());
|
||||
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair());
|
||||
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting());
|
||||
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed());
|
||||
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism());
|
||||
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
|
||||
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
|
||||
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords());
|
||||
player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
|
||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics());
|
||||
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
|
||||
(mcUsers.getProfile(player).getAcrobaticsInt()+
|
||||
mcUsers.getProfile(player).getArcheryInt()+
|
||||
mcUsers.getProfile(player).getAxesInt()+
|
||||
mcUsers.getProfile(player).getExcavationInt()+
|
||||
mcUsers.getProfile(player).getHerbalismInt()+
|
||||
mcUsers.getProfile(player).getMiningInt()+
|
||||
mcUsers.getProfile(player).getRepairInt()+
|
||||
mcUsers.getProfile(player).getSwordsInt()+
|
||||
mcUsers.getProfile(player).getUnarmedInt()+
|
||||
mcUsers.getProfile(player).getWoodCuttingint())
|
||||
);
|
||||
}
|
||||
//Invite Command
|
||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
|
||||
if(!mcUsers.getProfile(player).inParty()){
|
||||
player.sendMessage(ChatColor.RED+"You are not in a party.");
|
||||
return;
|
||||
}
|
||||
if(split.length < 2){
|
||||
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.invite+" <playername>");
|
||||
return;
|
||||
}
|
||||
if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty());
|
||||
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
|
||||
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
|
||||
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
|
||||
}
|
||||
}
|
||||
//Accept invite
|
||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
|
||||
if(mcUsers.getProfile(player).hasPartyInvite()){
|
||||
if(mcUsers.getProfile(player).inParty()){
|
||||
informPartyMembersQuit(player);
|
||||
}
|
||||
mcUsers.getProfile(player).acceptInvite();
|
||||
informPartyMembers(player);
|
||||
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED+"You have no invites at this time");
|
||||
}
|
||||
}
|
||||
//Party command
|
||||
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.party)){
|
||||
if(!mcPermissions.getInstance().party(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
|
||||
player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit");
|
||||
return;
|
||||
}
|
||||
if(split.length == 1 && mcUsers.getProfile(player).inParty()){
|
||||
String tempList = "";
|
||||
int x = 0;
|
||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){
|
||||
if(p != null && x+1 >= partyCount(player)){
|
||||
tempList+= p.getName();
|
||||
x++;
|
||||
}
|
||||
if(p != null && x < partyCount(player)){
|
||||
tempList+= p.getName() +", ";
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN+"You are in party \""+mcUsers.getProfile(player).getParty()+"\"");
|
||||
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
|
||||
}
|
||||
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){
|
||||
informPartyMembersQuit(player);
|
||||
mcUsers.getProfile(player).removeParty();
|
||||
player.sendMessage(ChatColor.RED + "You have left that party");
|
||||
return;
|
||||
}
|
||||
if(split.length >= 2){
|
||||
if(mcUsers.getProfile(player).inParty())
|
||||
informPartyMembersQuit(player);
|
||||
mcUsers.getProfile(player).setParty(split[1]);
|
||||
player.sendMessage("Joined Party: " + split[1]);
|
||||
informPartyMembers(player);
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/p")){
|
||||
if(!mcPermissions.getInstance().party(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(mcConfig.getInstance().isAdminToggled(player.getName()))
|
||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||
mcConfig.getInstance().togglePartyChat(playerName);
|
||||
if(mcConfig.getInstance().isPartyToggled(playerName)){
|
||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/a") && (player.isOp() || mcPermissions.getInstance().adminChat(player))){
|
||||
if(!mcPermissions.getInstance().adminChat(player) && !player.isOp()){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(mcConfig.getInstance().isPartyToggled(player.getName()))
|
||||
mcConfig.getInstance().togglePartyChat(playerName);
|
||||
mcConfig.getInstance().toggleAdminChat(playerName);
|
||||
if(mcConfig.getInstance().isAdminToggled(playerName)){
|
||||
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
|
||||
}
|
||||
}
|
||||
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.myspawn)){
|
||||
if(!mcPermissions.getInstance().mySpawn(player)){
|
||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if(mcUsers.getProfile(player).getMySpawn(player) != null){
|
||||
player.getInventory().clear();
|
||||
player.setHealth(20);
|
||||
player.teleportTo(mcUsers.getProfile(player).getMySpawn(player));
|
||||
player.sendMessage("Inventory cleared & health restored");
|
||||
}else{
|
||||
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String[] split = event.getMessage().split(" ");
|
||||
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
||||
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
||||
if(mcConfig.getInstance().isPartyToggled(player.getName())){
|
||||
event.setCancelled(true);
|
||||
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||
if(mcUsers.getProfile(herp).inParty()){
|
||||
if(mcm.getInstance().inSameParty(herp, player)){
|
||||
herp.sendMessage(x+event.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if((player.isOp() || mcPermissions.getInstance().adminChat(player))
|
||||
&& mcConfig.getInstance().isAdminToggled(player.getName())){
|
||||
log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage());
|
||||
event.setCancelled(true);
|
||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||
if(herp.isOp()){
|
||||
herp.sendMessage(y+event.getMessage());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 0.6
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 0.6.2
|
@ -0,0 +1,63 @@
|
||||
package com.gmail.nossr50.vPlayersOnline;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.ChatColor;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Handle events for all Player related events
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vPlayerListener extends PlayerListener {
|
||||
private final vPlayersOnline plugin;
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public vPlayerListener(vPlayersOnline instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
//Function to count the players
|
||||
public int playerCount(){
|
||||
Player players[] = plugin.getServer().getOnlinePlayers();
|
||||
int x = 0;
|
||||
for(Player hurrdurr: players){
|
||||
x++;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
//Message to be sent when a player joins
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
//English Version
|
||||
player.sendMessage(ChatColor.GREEN + "There are " + playerCount() + " players online.");
|
||||
}
|
||||
//Message to be sent when a player uses /list
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
String[] split = event.getMessage().split(" ");
|
||||
Player player = event.getPlayer();
|
||||
if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){
|
||||
event.setCancelled(true);
|
||||
String tempList = "";
|
||||
int x = 0;
|
||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(p != null && x+1 >= playerCount()){
|
||||
tempList+= p.getName();
|
||||
x++;
|
||||
}
|
||||
if(p != null && x < playerCount()){
|
||||
tempList+= p.getName() +", ";
|
||||
x++;
|
||||
}
|
||||
}
|
||||
//Output the player list
|
||||
player.sendMessage(ChatColor.RED + "Player List"+ChatColor.WHITE+" ("+ChatColor.WHITE + tempList+")");
|
||||
player.sendMessage(ChatColor.RED + "Total Players: " + ChatColor.GREEN + playerCount());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.gmail.nossr50.vPlayersOnline;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* vPlayersOnline for Bukkit
|
||||
*
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vPlayersOnline extends JavaPlugin {
|
||||
private final vPlayerListener playerListener = new vPlayerListener(this);
|
||||
private final String name = "vPlayersOnline";
|
||||
|
||||
public void onEnable() {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||
//Displays a message when plugin is loaded
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
}
|
||||
public void onDisable() {
|
||||
System.out.println("vPlayersOnline disabled.");
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
name: vPlayersOnline
|
||||
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
|
||||
version: 1.3
|
||||
name: vPlayersOnline
|
||||
main: com.gmail.nossr50.vPlayersOnline.vPlayersOnline
|
||||
version: 1.5
|
@ -1,29 +1,28 @@
|
||||
package com.bukkit.nossr50.vStopFire;
|
||||
|
||||
import org.bukkit.Block;
|
||||
import org.bukkit.BlockFace;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.block.BlockCanBuildEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
|
||||
/**
|
||||
* vStopFire block listener
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vBlockListener extends BlockListener {
|
||||
private final vStopFire plugin;
|
||||
|
||||
public vBlockListener(final vStopFire plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
//This should stop fire from spreading but still allow players to light stuff up with flint and steel
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
String cause = event.getCause().toString();
|
||||
if(cause.equals("SPREAD"))
|
||||
event.setCancelled(true);
|
||||
if(!cause.equals("FLINT_AND_STEEL"))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
package com.bukkit.nossr50.vStopFire;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.block.BlockCanBuildEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
/**
|
||||
* vStopFire block listener
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vBlockListener extends BlockListener {
|
||||
private final vStopFire plugin;
|
||||
|
||||
public vBlockListener(final vStopFire plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
//This should stop fire from spreading but still allow players to light stuff up with flint and steel
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
String cause = event.getCause().toString();
|
||||
if(cause.equals("SPREAD"))
|
||||
event.setCancelled(true);
|
||||
if(!cause.equals("FLINT_AND_STEEL"))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
package com.bukkit.nossr50.vStopFire;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
/**
|
||||
* Handle events for all Player related events
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vPlayerListener extends PlayerListener {
|
||||
private final vStopFire plugin;
|
||||
|
||||
public vPlayerListener(vStopFire instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
|
||||
//Insert Player related code here
|
||||
}
|
||||
|
||||
package com.bukkit.nossr50.vStopFire;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
/**
|
||||
* Handle events for all Player related events
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vPlayerListener extends PlayerListener {
|
||||
private final vStopFire plugin;
|
||||
|
||||
public vPlayerListener(vStopFire instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
|
||||
//Insert Player related code here
|
||||
}
|
||||
|
||||
|
@ -1,50 +1,29 @@
|
||||
package com.bukkit.nossr50.vStopFire;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.Player;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
/**
|
||||
* vStopFire for Bukkit
|
||||
*
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vStopFire extends JavaPlugin {
|
||||
private final vPlayerListener playerListener = new vPlayerListener(this);
|
||||
private final vBlockListener blockListener = new vBlockListener(this);
|
||||
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
||||
private final String name = "vStopFire";
|
||||
|
||||
public vStopFire(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onEnable() {
|
||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this);
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
}
|
||||
public void onDisable() {
|
||||
System.out.println("vStopFire disabled!");
|
||||
}
|
||||
public boolean isDebugging(final Player player) {
|
||||
if (debugees.containsKey(player)) {
|
||||
return debugees.get(player);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDebugging(final Player player, final boolean value) {
|
||||
debugees.put(player, value);
|
||||
}
|
||||
}
|
||||
package com.bukkit.nossr50.vStopFire;
|
||||
|
||||
import java.io.File;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
* vStopFire for Bukkit
|
||||
*
|
||||
* @author nossr50
|
||||
*/
|
||||
public class vStopFire extends JavaPlugin {
|
||||
private final vPlayerListener playerListener = new vPlayerListener(this);
|
||||
private final vBlockListener blockListener = new vBlockListener(this);
|
||||
private final String name = "vStopFire";
|
||||
|
||||
public void onEnable() {
|
||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this);
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
}
|
||||
public void onDisable() {
|
||||
System.out.println("vStopFire disabled!");
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: vStopFire
|
||||
main: com.bukkit.nossr50.vStopFire.vStopFire
|
||||
version: 1.0
|
||||
name: vStopFire
|
||||
main: com.bukkit.nossr50.vStopFire.vStopFire
|
||||
version: 1.1
|
11
woolplus/com/gmail/nossr50/woolplus/wBlockListener.java
Normal file
11
woolplus/com/gmail/nossr50/woolplus/wBlockListener.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.gmail.nossr50.woolplus;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
|
||||
public class wBlockListener extends BlockListener {
|
||||
private final woolplus plugin;
|
||||
|
||||
public wBlockListener(final woolplus plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
}
|
306
woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java
Normal file
306
woolplus/com/gmail/nossr50/woolplus/wPlayerListener.java
Normal file
@ -0,0 +1,306 @@
|
||||
package com.gmail.nossr50.woolplus;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerItemEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class wPlayerListener extends PlayerListener {
|
||||
private final woolplus plugin;
|
||||
|
||||
public wPlayerListener(woolplus instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
ItemStack item = event.getPlayer().getItemInHand();
|
||||
Block block = event.getBlockClicked();
|
||||
if(block != null && item != null && isDye(item) && isWool(block)){
|
||||
dyeWool(block, item, player);
|
||||
}
|
||||
}
|
||||
public boolean isDye(ItemStack item){
|
||||
int type = item.getTypeId();
|
||||
if(type == 351 || type == 352){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isWool(Block block){
|
||||
int type = block.getTypeId();
|
||||
if(type == 35){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isBoneMeal(ItemStack item){
|
||||
int type = item.getTypeId();
|
||||
short durability = item.getDurability();
|
||||
if(type == 351 && durability == 15){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void consumeDye(short type, Player player){
|
||||
ItemStack[] inventory = player.getInventory().getContents();
|
||||
for (ItemStack x : inventory){
|
||||
if(x.getTypeId() == 351 && x.getDurability() == type){
|
||||
if(x.getAmount() == 1){
|
||||
x.setAmount(0);
|
||||
x.setTypeId(0);
|
||||
}
|
||||
if(x.getAmount() > 1)
|
||||
x.setAmount(x.getAmount() - 1);
|
||||
player.getInventory().setContents(inventory);
|
||||
}
|
||||
}
|
||||
player.updateInventory();
|
||||
}
|
||||
public boolean isLightColoredWool(byte wool){
|
||||
if(wool == 4 || wool == 5 || wool == 6 || wool == 9 || wool == 2 || wool == 3){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void dyeWool(Block block, ItemStack item, Player player){
|
||||
MaterialData mdye = item.getData();
|
||||
byte dye = mdye.getData();
|
||||
byte wool = block.getData();
|
||||
short durability = item.getDurability();
|
||||
/*
|
||||
* WOOL LIGHTENING
|
||||
*/
|
||||
//Black dyes everything you know!
|
||||
if(durability == 0 && wool != 15){
|
||||
block.setData((byte) 15);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//BLACK -> GRAY
|
||||
if(wool == 15 && isBoneMeal(item)){
|
||||
block.setData((byte) 7);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//GRAY -> LGRAY
|
||||
if(wool == 7 && isBoneMeal(item)){
|
||||
block.setData((byte) 8);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//BROWN -> GRAY
|
||||
if(wool == 12 && isBoneMeal(item)){
|
||||
block.setData((byte) 7);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//LGRAY -> WHITE
|
||||
if(wool == 8 && isBoneMeal(item)){
|
||||
block.setData((byte) 0);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//RED (14) -> PINK (6)
|
||||
if(wool == 14 && isBoneMeal(item)){
|
||||
block.setData((byte) 6);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//GREEN13 -> LIME5
|
||||
if(wool == 13 && isBoneMeal(item)){
|
||||
block.setData((byte) 5);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//BLUE11 -> CYAN9
|
||||
if(wool == 11 && isBoneMeal(item)){
|
||||
block.setData((byte) 9);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//CYAN9 -> LIGHT BLUE3
|
||||
if(wool == 9 && isBoneMeal(item)){
|
||||
block.setData((byte) 3);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//PURPLE10 -> MAGENTA2
|
||||
if(wool == 10 && isBoneMeal(item)){
|
||||
block.setData((byte) 2);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* WOOL COMBINATIONS
|
||||
*/
|
||||
//Red + Yellow = Orange
|
||||
//If wool is red, dye is yellow
|
||||
if(wool == 14 && durability == 11){
|
||||
block.setData((byte) 1);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//If wool is yellow, dye is red
|
||||
if(wool == 4 && durability == 1){
|
||||
block.setData((byte) 1);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//Lapis + Green = Cyan
|
||||
//if wool is Lapis/Blue, dye is green
|
||||
if(wool == 11 && durability == 2){
|
||||
block.setData((byte) 9);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//if wool is Green, dye is lapis
|
||||
if(wool == 13 && durability == 4){
|
||||
block.setData((byte) 9);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//Red + Lapis = Purple
|
||||
//if wool is Red, dye is Lapis
|
||||
if(wool == 14 && durability == 4){
|
||||
block.setData((byte) 10);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//if wool is Lapis/Blue, dye is red
|
||||
if(wool == 11 && durability == 1){
|
||||
block.setData((byte) 10);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//Purple + Pink = Magenta
|
||||
//if wool is Purple, dye is pink
|
||||
if(wool == 10 && durability == 9){
|
||||
block.setData((byte) 2);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//if wool is pink, dye is purple
|
||||
if(wool == 6 && durability == 5){
|
||||
block.setData((byte) 2);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* REGULAR DYE SECTION
|
||||
*/
|
||||
if(wool == 0){
|
||||
//orange
|
||||
if(durability == 14){
|
||||
block.setData((byte) 1);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//magenta
|
||||
if (durability == 13){
|
||||
block.setData((byte) 2);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//light blue
|
||||
if(durability == 12){
|
||||
block.setData((byte) 3);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//yellow
|
||||
if(durability == 11){
|
||||
block.setData((byte) 4);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//lime
|
||||
if(durability == 10){
|
||||
block.setData((byte) 5);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//pink
|
||||
if(durability == 9){
|
||||
block.setData((byte) 6);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//gray
|
||||
if(durability == 8){
|
||||
block.setData((byte) 7);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//light gray
|
||||
if(durability == 7){
|
||||
block.setData((byte) 8);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//cyan
|
||||
if(durability == 6){
|
||||
block.setData((byte) 9);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//purple
|
||||
if(durability == 5){
|
||||
block.setData((byte) 10);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//lapis or blue
|
||||
if(durability == 4){
|
||||
block.setData((byte) 11);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//coco or brown
|
||||
if(durability == 3){
|
||||
block.setData((byte) 12);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//green
|
||||
if(durability == 2){
|
||||
block.setData((byte) 13);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
//red
|
||||
if(durability == 1){
|
||||
block.setData((byte) 14);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* BROWN CONVERSION
|
||||
*/
|
||||
if(!isBoneMeal(item) && durability != 0 && wool != 12){
|
||||
block.setData((byte) 12);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
if(isBoneMeal(item) && wool != 0 && !isLightColoredWool(wool)){
|
||||
block.setData((byte) 7);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
if(isBoneMeal(item) && wool != 0 && isLightColoredWool(wool)){
|
||||
block.setData((byte) 0);
|
||||
consumeDye(item.getDurability(), player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
29
woolplus/com/gmail/nossr50/woolplus/woolplus.java
Normal file
29
woolplus/com/gmail/nossr50/woolplus/woolplus.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.gmail.nossr50.woolplus;
|
||||
|
||||
import java.io.File;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
* Wool Plus for Bukkit
|
||||
*
|
||||
* @author nossr50
|
||||
*/
|
||||
public class woolplus extends JavaPlugin {
|
||||
private final wPlayerListener playerListener = new wPlayerListener(this);
|
||||
private final wBlockListener blockListener = new wBlockListener(this);
|
||||
private final String name = "Wool Plus";
|
||||
|
||||
public void onEnable() {
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
}
|
||||
public void onDisable() {
|
||||
System.out.println("Wool Plus disabled!");
|
||||
}
|
||||
}
|
3
woolplus/plugin.yml
Normal file
3
woolplus/plugin.yml
Normal file
@ -0,0 +1,3 @@
|
||||
name: woolplus
|
||||
main: com.gmail.nossr50.woolplus.woolplus
|
||||
version: 1.2
|
Loading…
Reference in New Issue
Block a user