mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +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);
|
||||
}
|
||||
}
|
||||
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){
|
||||
@ -146,8 +142,9 @@ public class mcCombat {
|
||||
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||
}
|
||||
if(defender.getHealth() <= 0)
|
||||
if(defender.getHealth() <= 0){
|
||||
mcm.getInstance().simulateNaturalDrops(defender);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UNARMED VS SQUID
|
||||
@ -185,8 +182,9 @@ public class mcCombat {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,8 +200,9 @@ public class mcCombat {
|
||||
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||
}
|
||||
if(defender.getHealth() <= 0)
|
||||
if(defender.getHealth() <= 0){
|
||||
mcm.getInstance().simulateNaturalDrops(defender);
|
||||
}
|
||||
}
|
||||
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
||||
if(defender.getHealth() <= 0)
|
||||
|
@ -69,9 +69,9 @@ public class mcEntityListener extends EntityListener {
|
||||
*/
|
||||
if(e instanceof Player){
|
||||
Player defender = (Player)e;
|
||||
if(mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
||||
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
||||
event.setCancelled(true);
|
||||
if(f instanceof Monster){
|
||||
if(f instanceof Monster && defender != null){
|
||||
mcUsers.getProfile(defender).setRecentlyHurt(30);
|
||||
}
|
||||
/*
|
||||
|
@ -30,14 +30,9 @@ public class mcMMO extends JavaPlugin {
|
||||
private Permissions permissions;
|
||||
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
|
||||
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
|
||||
new File(maindirectory).mkdir();
|
||||
//Make the file if it does not exist
|
||||
@ -69,8 +64,6 @@ public class mcMMO extends JavaPlugin {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
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_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.PLAYER_CHAT, playerListener, Priority.Monitor, 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_ITEM_HELD, playerListener, 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
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
mcPermissions.initialize(getServer());
|
||||
|
@ -24,15 +24,15 @@ public class mcPlayerListener extends PlayerListener {
|
||||
plugin = instance;
|
||||
}
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(player != null){
|
||||
Player player = event.getPlayer();
|
||||
if(player != null){
|
||||
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)
|
||||
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
|
||||
if(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null)
|
||||
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
|
||||
if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){
|
||||
event.setRespawnLocation(mySpawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public Player[] getPlayersOnline() {
|
||||
return plugin.getServer().getOnlinePlayers();
|
||||
@ -75,7 +75,7 @@ public class mcPlayerListener extends PlayerListener {
|
||||
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||
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.
|
||||
mcRepair.getInstance().repairCheck(player, is, block);
|
||||
}
|
||||
@ -148,6 +148,9 @@ public class mcPlayerListener extends PlayerListener {
|
||||
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.ptp+" <playername>");
|
||||
return;
|
||||
}
|
||||
if(!isPlayer(split[1])){
|
||||
player.sendMessage("That is not a valid player");
|
||||
}
|
||||
if(isPlayer(split[1])){
|
||||
Player target = getPlayer(split[1]);
|
||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){
|
||||
|
@ -18,33 +18,36 @@ public class mcRepair {
|
||||
return instance;
|
||||
}
|
||||
public void repairCheck(Player player, ItemStack is, Block block){
|
||||
player.sendMessage("mcMMO Debug: The block is an Anvil.");
|
||||
if(block != null
|
||||
&& block.getTypeId() == 42
|
||||
&& 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){
|
||||
player.sendMessage("mcMMO Debug: The item is not at full durability.");
|
||||
/*
|
||||
* ARMOR
|
||||
*/
|
||||
if(isArmor(is) && block.getTypeId() == 42){
|
||||
if(isArmor(is)){
|
||||
player.sendMessage("mcMMO Debug: The item is armor.");
|
||||
/*
|
||||
* DIAMOND ARMOR
|
||||
*/
|
||||
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
|
||||
player.sendMessage("mcMMO Debug: CODE 1");
|
||||
removeDiamond(player);
|
||||
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||
mcUsers.getProfile(player).addRepairGather(75);
|
||||
} else if (isIronArmor(is) && hasIron(player)){
|
||||
player.sendMessage("mcMMO Debug: CODE 2");
|
||||
/*
|
||||
* IRON ARMOR
|
||||
*/
|
||||
removeIron(player);
|
||||
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||
/*
|
||||
* DISTRIBUTE REPAIR XP
|
||||
*/
|
||||
mcUsers.getProfile(player).addRepairGather(20);
|
||||
//GOLD ARMOR
|
||||
} else if (isGoldArmor(is) && hasGold(player)){
|
||||
player.sendMessage("mcMMO Debug: CODE 3");
|
||||
removeGold(player);
|
||||
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||
mcUsers.getProfile(player).addRepairGather(50);
|
||||
@ -55,11 +58,12 @@ public class mcRepair {
|
||||
/*
|
||||
* TOOLS
|
||||
*/
|
||||
if(isTools(is) && block.getTypeId() == 42){
|
||||
if(isTools(is)){
|
||||
/*
|
||||
* IRON TOOLS
|
||||
*/
|
||||
if(isIronTools(is) && hasIron(player)){
|
||||
player.sendMessage("mcMMO Debug: CODE 4");
|
||||
is.setDurability(getToolRepairAmount(is, player));
|
||||
removeIron(player);
|
||||
mcUsers.getProfile(player).addRepairGather(20);
|
||||
@ -67,14 +71,17 @@ public class mcRepair {
|
||||
/*
|
||||
* DIAMOND TOOLS
|
||||
*/
|
||||
player.sendMessage("mcMMO Debug: CODE 5");
|
||||
is.setDurability(getToolRepairAmount(is, player));
|
||||
removeDiamond(player);
|
||||
mcUsers.getProfile(player).addRepairGather(75);
|
||||
} else if(isGoldTools(is) && hasGold(player)){
|
||||
player.sendMessage("mcMMO Debug: CODE 6");
|
||||
is.setDurability(getToolRepairAmount(is, player));
|
||||
removeGold(player);
|
||||
mcUsers.getProfile(player).addRepairGather(50);
|
||||
} else {
|
||||
player.sendMessage("mcMMO Debug: CODE 7");
|
||||
needMoreVespeneGas(is, player);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ public class mcTimer extends TimerTask{
|
||||
public mcTimer(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
||||
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
|
||||
@ -24,16 +25,16 @@ public class mcTimer extends TimerTask{
|
||||
}
|
||||
}
|
||||
if(thecount == 10 || thecount == 20){
|
||||
for(Player player : playerlist){
|
||||
if(player != null &&
|
||||
player.getHealth() > 0 && player.getHealth() < 20
|
||||
&& mcUsers.getProfile(player).getPowerLevel() >= 500
|
||||
&& mcUsers.getProfile(player).getPowerLevel() < 1000
|
||||
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
|
||||
&& mcPermissions.getInstance().regeneration(player)){
|
||||
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
||||
}
|
||||
}
|
||||
for(Player player : playerlist){
|
||||
if(player != null &&
|
||||
player.getHealth() > 0 && player.getHealth() < 20
|
||||
&& mcUsers.getProfile(player).getPowerLevel() >= 500
|
||||
&& mcUsers.getProfile(player).getPowerLevel() < 1000
|
||||
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
|
||||
&& mcPermissions.getInstance().regeneration(player)){
|
||||
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(thecount == 20){
|
||||
for(Player player : playerlist){
|
||||
@ -51,9 +52,6 @@ public class mcTimer extends TimerTask{
|
||||
mcUsers.getProfile(player).decreaseLastHurt();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* RESET THE COUNT
|
||||
*/
|
||||
if(thecount < 20){
|
||||
thecount++;
|
||||
} else {
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: 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