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