mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
All updated to the latest WIP build
This commit is contained in:
parent
89cda9adf5
commit
a633821158
@ -102,10 +102,6 @@ public class mcCombat {
|
|||||||
defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp);
|
defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(defender).isDead())
|
|
||||||
return;
|
|
||||||
if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty()))
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
@ -146,8 +142,9 @@ public class mcCombat {
|
|||||||
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||||
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||||
}
|
}
|
||||||
if(defender.getHealth() <= 0)
|
if(defender.getHealth() <= 0){
|
||||||
mcm.getInstance().simulateNaturalDrops(defender);
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* UNARMED VS SQUID
|
* UNARMED VS SQUID
|
||||||
@ -185,8 +182,9 @@ public class mcCombat {
|
|||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(defender.getHealth() <= 0)
|
if(defender.getHealth() <= 0){
|
||||||
mcm.getInstance().simulateNaturalDrops(defender);
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,8 +200,9 @@ public class mcCombat {
|
|||||||
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||||
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||||
}
|
}
|
||||||
if(defender.getHealth() <= 0)
|
if(defender.getHealth() <= 0){
|
||||||
mcm.getInstance().simulateNaturalDrops(defender);
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
||||||
if(defender.getHealth() <= 0)
|
if(defender.getHealth() <= 0)
|
||||||
|
@ -69,9 +69,9 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(e instanceof Player){
|
if(e instanceof Player){
|
||||||
Player defender = (Player)e;
|
Player defender = (Player)e;
|
||||||
if(mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(f instanceof Monster){
|
if(f instanceof Monster && defender != null){
|
||||||
mcUsers.getProfile(defender).setRecentlyHurt(30);
|
mcUsers.getProfile(defender).setRecentlyHurt(30);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -29,15 +29,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static PermissionHandler PermissionsHandler = null;
|
public static PermissionHandler PermissionsHandler = null;
|
||||||
private Permissions permissions;
|
private Permissions permissions;
|
||||||
private Timer mcMMO_Timer = new Timer(true);
|
private Timer mcMMO_Timer = new Timer(true);
|
||||||
|
|
||||||
/*
|
|
||||||
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
|
||||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//herp
|
//herp
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
|
//mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
|
||||||
//Make the directory if it does not exist
|
//Make the directory if it does not exist
|
||||||
new File(maindirectory).mkdir();
|
new File(maindirectory).mkdir();
|
||||||
//Make the file if it does not exist
|
//Make the file if it does not exist
|
||||||
@ -69,8 +64,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_LOGIN, 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.BLOCK_DAMAGED, blockListener, 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.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.High, this);
|
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.High, this);
|
||||||
@ -81,7 +74,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, 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.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
|
//pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
|
||||||
//Displays a message when plugin is loaded
|
//Displays a message when plugin is loaded
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
mcPermissions.initialize(getServer());
|
mcPermissions.initialize(getServer());
|
||||||
|
@ -24,15 +24,15 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(player != null){
|
if(player != null){
|
||||||
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player);
|
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player);
|
||||||
if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("") && plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null)
|
if(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null)
|
||||||
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
|
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
|
||||||
if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){
|
if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){
|
||||||
event.setRespawnLocation(mySpawn);
|
event.setRespawnLocation(mySpawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Player[] getPlayersOnline() {
|
public Player[] getPlayersOnline() {
|
||||||
return plugin.getServer().getOnlinePlayers();
|
return plugin.getServer().getOnlinePlayers();
|
||||||
@ -75,7 +75,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||||
mcHerbalism.getInstance().stewCheck(player, is);
|
mcHerbalism.getInstance().stewCheck(player, is);
|
||||||
}
|
}
|
||||||
if(mcPermissions.getInstance().repair(player)){
|
if(block != null && player != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == 42){
|
||||||
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
||||||
mcRepair.getInstance().repairCheck(player, is, block);
|
mcRepair.getInstance().repairCheck(player, is, block);
|
||||||
}
|
}
|
||||||
@ -148,6 +148,9 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.ptp+" <playername>");
|
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.ptp+" <playername>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!isPlayer(split[1])){
|
||||||
|
player.sendMessage("That is not a valid player");
|
||||||
|
}
|
||||||
if(isPlayer(split[1])){
|
if(isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
||||||
|
@ -18,33 +18,36 @@ public class mcRepair {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
public void repairCheck(Player player, ItemStack is, Block block){
|
public void repairCheck(Player player, ItemStack is, Block block){
|
||||||
if(block != null
|
player.sendMessage("mcMMO Debug: The block is an Anvil.");
|
||||||
&& block.getTypeId() == 42
|
if(block != null
|
||||||
&& mcPermissions.getInstance().repair(player)){
|
&& mcPermissions.getInstance().repair(player)){
|
||||||
|
player.sendMessage("mcMMO Debug: The block is not null and the player has access to repair.");
|
||||||
if(player.getItemInHand().getDurability() > 0){
|
if(player.getItemInHand().getDurability() > 0){
|
||||||
|
player.sendMessage("mcMMO Debug: The item is not at full durability.");
|
||||||
/*
|
/*
|
||||||
* ARMOR
|
* ARMOR
|
||||||
*/
|
*/
|
||||||
if(isArmor(is) && block.getTypeId() == 42){
|
if(isArmor(is)){
|
||||||
|
player.sendMessage("mcMMO Debug: The item is armor.");
|
||||||
/*
|
/*
|
||||||
* DIAMOND ARMOR
|
* DIAMOND ARMOR
|
||||||
*/
|
*/
|
||||||
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
|
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 1");
|
||||||
removeDiamond(player);
|
removeDiamond(player);
|
||||||
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||||
mcUsers.getProfile(player).addRepairGather(75);
|
mcUsers.getProfile(player).addRepairGather(75);
|
||||||
} else if (isIronArmor(is) && hasIron(player)){
|
} else if (isIronArmor(is) && hasIron(player)){
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 2");
|
||||||
/*
|
/*
|
||||||
* IRON ARMOR
|
* IRON ARMOR
|
||||||
*/
|
*/
|
||||||
removeIron(player);
|
removeIron(player);
|
||||||
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||||
/*
|
|
||||||
* DISTRIBUTE REPAIR XP
|
|
||||||
*/
|
|
||||||
mcUsers.getProfile(player).addRepairGather(20);
|
mcUsers.getProfile(player).addRepairGather(20);
|
||||||
//GOLD ARMOR
|
//GOLD ARMOR
|
||||||
} else if (isGoldArmor(is) && hasGold(player)){
|
} else if (isGoldArmor(is) && hasGold(player)){
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 3");
|
||||||
removeGold(player);
|
removeGold(player);
|
||||||
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||||
mcUsers.getProfile(player).addRepairGather(50);
|
mcUsers.getProfile(player).addRepairGather(50);
|
||||||
@ -55,11 +58,12 @@ public class mcRepair {
|
|||||||
/*
|
/*
|
||||||
* TOOLS
|
* TOOLS
|
||||||
*/
|
*/
|
||||||
if(isTools(is) && block.getTypeId() == 42){
|
if(isTools(is)){
|
||||||
/*
|
/*
|
||||||
* IRON TOOLS
|
* IRON TOOLS
|
||||||
*/
|
*/
|
||||||
if(isIronTools(is) && hasIron(player)){
|
if(isIronTools(is) && hasIron(player)){
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 4");
|
||||||
is.setDurability(getToolRepairAmount(is, player));
|
is.setDurability(getToolRepairAmount(is, player));
|
||||||
removeIron(player);
|
removeIron(player);
|
||||||
mcUsers.getProfile(player).addRepairGather(20);
|
mcUsers.getProfile(player).addRepairGather(20);
|
||||||
@ -67,14 +71,17 @@ public class mcRepair {
|
|||||||
/*
|
/*
|
||||||
* DIAMOND TOOLS
|
* DIAMOND TOOLS
|
||||||
*/
|
*/
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 5");
|
||||||
is.setDurability(getToolRepairAmount(is, player));
|
is.setDurability(getToolRepairAmount(is, player));
|
||||||
removeDiamond(player);
|
removeDiamond(player);
|
||||||
mcUsers.getProfile(player).addRepairGather(75);
|
mcUsers.getProfile(player).addRepairGather(75);
|
||||||
} else if(isGoldTools(is) && hasGold(player)){
|
} else if(isGoldTools(is) && hasGold(player)){
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 6");
|
||||||
is.setDurability(getToolRepairAmount(is, player));
|
is.setDurability(getToolRepairAmount(is, player));
|
||||||
removeGold(player);
|
removeGold(player);
|
||||||
mcUsers.getProfile(player).addRepairGather(50);
|
mcUsers.getProfile(player).addRepairGather(50);
|
||||||
} else {
|
} else {
|
||||||
|
player.sendMessage("mcMMO Debug: CODE 7");
|
||||||
needMoreVespeneGas(is, player);
|
needMoreVespeneGas(is, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ public class mcTimer extends TimerTask{
|
|||||||
public mcTimer(final mcMMO plugin) {
|
public mcTimer(final mcMMO plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
||||||
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
|
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
|
||||||
@ -24,16 +25,16 @@ public class mcTimer extends TimerTask{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 10 || thecount == 20){
|
if(thecount == 10 || thecount == 20){
|
||||||
for(Player player : playerlist){
|
for(Player player : playerlist){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcUsers.getProfile(player).getPowerLevel() >= 500
|
&& mcUsers.getProfile(player).getPowerLevel() >= 500
|
||||||
&& mcUsers.getProfile(player).getPowerLevel() < 1000
|
&& mcUsers.getProfile(player).getPowerLevel() < 1000
|
||||||
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
|
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
|
||||||
&& mcPermissions.getInstance().regeneration(player)){
|
&& mcPermissions.getInstance().regeneration(player)){
|
||||||
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 20){
|
if(thecount == 20){
|
||||||
for(Player player : playerlist){
|
for(Player player : playerlist){
|
||||||
@ -51,9 +52,6 @@ public class mcTimer extends TimerTask{
|
|||||||
mcUsers.getProfile(player).decreaseLastHurt();
|
mcUsers.getProfile(player).decreaseLastHurt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* RESET THE COUNT
|
|
||||||
*/
|
|
||||||
if(thecount < 20){
|
if(thecount < 20){
|
||||||
thecount++;
|
thecount++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 0.8.11 WIP no. 4
|
version: 0.8.11 WIP B15
|
Loading…
Reference in New Issue
Block a user