mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
Cleanup
This commit is contained in:
@ -115,15 +115,14 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
if (Config.getInstance().getStatsTrackingEnabled()) {
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Failed to submit stats.");
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Failed to submit stats.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get profile of the player.
|
||||
* </br>
|
||||
@ -164,23 +163,20 @@ public class mcMMO extends JavaPlugin {
|
||||
* Things to be run when the plugin is disabled.
|
||||
*/
|
||||
public void onDisable() {
|
||||
|
||||
//Make sure to save player information if the server shuts down
|
||||
for (PlayerProfile x : Users.getProfiles().values()) {
|
||||
x.save();
|
||||
}
|
||||
|
||||
|
||||
this.getServer().getScheduler().cancelTasks(this); //This removes our tasks
|
||||
|
||||
|
||||
//Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
||||
|
||||
try { //Try the backup
|
||||
ZipLibrary.mcMMObackup();
|
||||
} catch (IOException e) {
|
||||
p.getLogger().severe(e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
ZipLibrary.mcMMObackup();
|
||||
} catch (IOException e) {
|
||||
p.getLogger().severe(e.toString());
|
||||
}
|
||||
|
||||
System.out.println("mcMMO was disabled."); //How informative!
|
||||
}
|
||||
|
||||
@ -188,7 +184,6 @@ public class mcMMO extends JavaPlugin {
|
||||
* Register the commands.
|
||||
*/
|
||||
private void registerCommands() {
|
||||
|
||||
//Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands)
|
||||
//Skills commands
|
||||
aliasMap.put(LocaleLoader.getString("Acrobatics.SkillName").toLowerCase(), "acrobatics");
|
||||
|
@ -15,7 +15,7 @@ import com.gmail.nossr50.util.Combat;
|
||||
|
||||
public class BleedTimer implements Runnable {
|
||||
private final static int MAX_BLEED_TICKS = 10;
|
||||
|
||||
|
||||
private static Map<LivingEntity, Integer> bleedList = new HashMap<LivingEntity, Integer>();
|
||||
private static Map<LivingEntity, Integer> bleedAddList = new HashMap<LivingEntity, Integer>();
|
||||
private static List<LivingEntity> bleedRemoveList = new ArrayList<LivingEntity>();
|
||||
@ -121,6 +121,7 @@ public class BleedTimer implements Runnable {
|
||||
* Add a LivingEntity to the bleedList if it is not in it.
|
||||
*
|
||||
* @param entity LivingEntity to add
|
||||
* @param ticks Number of bleeding ticks
|
||||
*/
|
||||
public static void add(LivingEntity entity, int ticks) {
|
||||
int newTicks = ticks;
|
||||
@ -128,7 +129,7 @@ public class BleedTimer implements Runnable {
|
||||
if (lock) {
|
||||
if (bleedAddList.containsKey(entity)) {
|
||||
newTicks += bleedAddList.get(entity);
|
||||
|
||||
|
||||
if (newTicks > MAX_BLEED_TICKS) {
|
||||
newTicks = MAX_BLEED_TICKS;
|
||||
}
|
||||
@ -146,7 +147,7 @@ public class BleedTimer implements Runnable {
|
||||
else {
|
||||
if (bleedList.containsKey(entity)) {
|
||||
newTicks += bleedList.get(entity);
|
||||
|
||||
|
||||
if (newTicks > MAX_BLEED_TICKS) {
|
||||
newTicks = MAX_BLEED_TICKS;
|
||||
}
|
||||
|
@ -236,6 +236,7 @@ public class BlastMining {
|
||||
/**
|
||||
* Detonate TNT for Blast Mining
|
||||
*
|
||||
* @param event The PlayerInteractEvent
|
||||
* @param player Player detonating the TNT
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
|
@ -310,11 +310,11 @@ public class Combat {
|
||||
if (!(entity instanceof LivingEntity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (numberOfTargets <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (entity.getType()) {
|
||||
case WOLF:
|
||||
AnimalTamer tamer = ((Wolf) entity).getOwner();
|
||||
@ -324,50 +324,49 @@ public class Combat {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case PLAYER:
|
||||
Player defender = (Player) entity;
|
||||
|
||||
|
||||
if (!target.getWorld().getPVP()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (defender.getName().equals(attacker.getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Party.getInstance().inSameParty(attacker, defender)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
PlayerProfile playerProfile = Users.getProfile((Player) entity);
|
||||
|
||||
|
||||
if (playerProfile.getGodMode()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch (type) {
|
||||
case SWORDS:
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck"));
|
||||
}
|
||||
|
||||
|
||||
BleedTimer.add((LivingEntity) entity, 5);
|
||||
|
||||
|
||||
break;
|
||||
case AXES:
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.Cleave.Struck"));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
dealDamage((LivingEntity) entity, damageAmount, attacker);
|
||||
numberOfTargets--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user