mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Cleanup!
This commit is contained in:
parent
7ada587df3
commit
1cca4de9e5
@ -46,7 +46,7 @@ public abstract class SkillCommand implements CommandExecutor {
|
||||
player = (Player) sender;
|
||||
profile = Users.getProfile(player);
|
||||
|
||||
skillValue = (float) profile.getSkillLevel(skill);
|
||||
skillValue = profile.getSkillLevel(skill);
|
||||
dataCalculations();
|
||||
permissionsCheck();
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
PP.setRecentlyHurt((long) 0);
|
||||
PP.setRecentlyHurt(0);
|
||||
PP.resetCooldowns();
|
||||
PP.resetToolPrepMode();
|
||||
PP.resetAbilityMode();
|
||||
|
@ -187,7 +187,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
PlayerProfile PPt = Users.getProfile(target);
|
||||
String targetName = target.getName();
|
||||
|
||||
if (!partyInstance.inSameParty(player, (Player) target)) {
|
||||
if (!partyInstance.inSameParty(player, target)) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { targetName }));
|
||||
return true;
|
||||
}
|
||||
@ -219,7 +219,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
|
||||
String targetName = target.getName();
|
||||
|
||||
if (!partyInstance.inSameParty(player, (Player) target)) {
|
||||
if (!partyInstance.inSameParty(player, target)) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { targetName }));
|
||||
return true;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public class HUDmmo {
|
||||
return;
|
||||
}
|
||||
|
||||
((GenericTexture) xpicon).setUrl(Misc.getCapitalized(theType.toString()) + ".png");
|
||||
xpicon.setUrl(Misc.getCapitalized(theType.toString()) + ".png");
|
||||
xpicon.setDirty(true);
|
||||
|
||||
((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
|
||||
|
@ -62,6 +62,7 @@ public class McMMOItemSpawnEvent extends Event implements Cancellable {
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class HardcoreListener implements Listener {
|
||||
if (!Permissions.getInstance().hardcoremodeBypass(player)) {
|
||||
if (player.getKiller() instanceof Player) {
|
||||
if (Config.getInstance().getHardcoreVampirismEnabled()) {
|
||||
Hardcore.invokeVampirism(((Player)player.getKiller()), player);
|
||||
Hardcore.invokeVampirism(player.getKiller(), player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//TODO: Locale ALL the things.
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.getInstance().motd(player)) {
|
||||
String prefix = ChatColor.GOLD+"[mcMMO] ";
|
||||
String perkPrefix = ChatColor.RED+"[mcMMO Perks] ";
|
||||
|
@ -76,6 +76,7 @@ public class mcMMO extends JavaPlugin {
|
||||
/**
|
||||
* Things to be run when the plugin is enabled.
|
||||
*/
|
||||
@Override
|
||||
public void onEnable() {
|
||||
p = this;
|
||||
setupFilePaths();
|
||||
@ -238,6 +239,7 @@ public class mcMMO extends JavaPlugin {
|
||||
/**
|
||||
* Things to be run when the plugin is disabled.
|
||||
*/
|
||||
@Override
|
||||
public void onDisable() {
|
||||
//Make sure to save player information if the server shuts down
|
||||
for (PlayerProfile x : Users.getProfiles().values()) {
|
||||
|
@ -319,7 +319,7 @@ public class Combat {
|
||||
*/
|
||||
private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
|
||||
if (configInstance.getEventCallbackEnabled()) {
|
||||
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
|
||||
EntityDamageEvent ede = new FakeEntityDamageEvent(target, cause, dmg);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) {
|
||||
@ -342,7 +342,7 @@ public class Combat {
|
||||
*/
|
||||
private static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
||||
if (configInstance.getEventCallbackEnabled()) {
|
||||
EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||
EntityDamageEvent ede = new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) {
|
||||
|
@ -225,6 +225,7 @@ public class Metrics {
|
||||
|
||||
private boolean firstPost = true;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// This has to be synchronized or it can collide with the disable method.
|
||||
|
@ -18,6 +18,7 @@ import com.gmail.nossr50.mcMMO;
|
||||
public class HashChunkletManager implements ChunkletManager {
|
||||
private HashMap<String, ChunkletStore> store = new HashMap<String, ChunkletStore>();
|
||||
|
||||
@Override
|
||||
public void chunkLoaded(int cx, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
@ -38,6 +39,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chunkUnloaded(int cx, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
|
||||
@ -56,6 +58,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWorld(World world) {
|
||||
String worldName = world.getName();
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
@ -74,6 +77,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadWorld(World world) {
|
||||
saveWorld(world);
|
||||
|
||||
@ -87,12 +91,14 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAll() {
|
||||
for(World world : Bukkit.getWorlds()) {
|
||||
saveWorld(world);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadAll() {
|
||||
saveAll();
|
||||
for(World world : Bukkit.getWorlds()) {
|
||||
@ -100,6 +106,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrue(int x, int y, int z, World world) {
|
||||
int cx = x / 16;
|
||||
int cz = z / 16;
|
||||
@ -114,10 +121,12 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
return check.isTrue(ix, iy, iz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrue(Block block) {
|
||||
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(int x, int y, int z, World world) {
|
||||
int cx = x / 16;
|
||||
int cz = z / 16;
|
||||
@ -137,10 +146,12 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
cStore.setTrue(ix, iy, iz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(Block block) {
|
||||
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFalse(int x, int y, int z, World world) {
|
||||
int cx = x / 16;
|
||||
int cz = z / 16;
|
||||
@ -159,10 +170,12 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
cStore.setFalse(ix, iy, iz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFalse(Block block) {
|
||||
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
for(String key : store.keySet()) {
|
||||
if(store.get(key).isEmpty()) {
|
||||
|
@ -6,18 +6,22 @@ public class PrimitiveChunkletStore implements ChunkletStore {
|
||||
/** X, Z, Y */
|
||||
private boolean[][][] store = new boolean[16][16][64];
|
||||
|
||||
@Override
|
||||
public boolean isTrue(int x, int y, int z) {
|
||||
return store[x][z][y];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(int x, int y, int z) {
|
||||
store[x][z][y] = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFalse(int x, int y, int z) {
|
||||
store[x][z][y] = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user