mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
General cleanup to satisfy my OCD a little while longer.
This commit is contained in:
parent
900623461a
commit
0711454e31
@ -9,8 +9,8 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.SpoutConfig;
|
||||
import com.gmail.nossr50.datatypes.HudType;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
|
@ -30,8 +30,8 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.runnables.StickyPistonTracker;
|
||||
import com.gmail.nossr50.skills.gathering.Excavation;
|
||||
import com.gmail.nossr50.skills.gathering.Herbalism;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.gathering.WoodCutting;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Salvage;
|
||||
import com.gmail.nossr50.spout.SpoutSounds;
|
||||
|
@ -12,8 +12,8 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.config.SpoutConfig;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SpoutHud;
|
||||
import com.gmail.nossr50.datatypes.buttons.McmmoButton;
|
||||
import com.gmail.nossr50.datatypes.popups.Menu;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.gmail.nossr50.commands.general.AddlevelsCommand;
|
||||
import com.gmail.nossr50.commands.general.AddxpCommand;
|
||||
import com.gmail.nossr50.commands.general.InspectCommand;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import java.lang.Runnable;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
@ -35,6 +33,7 @@ public class MobStoreCleaner implements Runnable
|
||||
taskID = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mcMMO.placeStore.cleanMobLists();
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.gmail.nossr50.runnables.blockstoreconversion;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.Runnable;
|
||||
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
|
||||
public class BlockStoreConversionMain implements Runnable {
|
||||
private int taskID, i;
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.gmail.nossr50.runnables.blockstoreconversion;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.Runnable;
|
||||
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
|
||||
public class BlockStoreConversionXDirectory implements Runnable {
|
||||
private int taskID, i;
|
||||
|
@ -1,18 +1,16 @@
|
||||
package com.gmail.nossr50.runnables.blockstoreconversion;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.Runnable;
|
||||
import java.lang.String;
|
||||
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.blockmeta.ChunkletStore;
|
||||
import com.gmail.nossr50.util.blockmeta.HashChunkletManager;
|
||||
import com.gmail.nossr50.util.blockmeta.PrimitiveChunkletStore;
|
||||
import com.gmail.nossr50.util.blockmeta.PrimitiveExChunkletStore;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.PrimitiveChunkStore;
|
||||
import com.gmail.nossr50.util.blockmeta.HashChunkletManager;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.HashChunkManager;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.PrimitiveChunkStore;
|
||||
|
||||
public class BlockStoreConversionZDirectory implements Runnable {
|
||||
public int taskID, cx, cz, x, y, z, y2, xPos, zPos, cxPos, czPos;
|
||||
|
@ -107,7 +107,7 @@ public class Herbalism {
|
||||
randomChance = 75;
|
||||
}
|
||||
|
||||
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel);
|
||||
float chance = (float) ((MAX_CHANCE / MAX_BONUS_LEVEL) * herbLevel);
|
||||
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
|
||||
|
||||
switch (type) {
|
||||
@ -455,7 +455,7 @@ public class Herbalism {
|
||||
}
|
||||
|
||||
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel);
|
||||
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
|
||||
if (chance > MAX_CHANCE) chance = MAX_CHANCE;
|
||||
|
||||
if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > Misc.getRandom().nextInt(randomChance))) {
|
||||
event.setCancelled(true);
|
||||
@ -529,7 +529,7 @@ public class Herbalism {
|
||||
}
|
||||
|
||||
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
|
||||
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
|
||||
if (chance > MAX_CHANCE) chance = MAX_CHANCE;
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||
greenTerraConvert(player, block);
|
||||
|
@ -205,8 +205,8 @@ public class Repair {
|
||||
*/
|
||||
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
|
||||
float bonus;
|
||||
if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F);
|
||||
else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F);
|
||||
if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = (REPAIR_MASTERY_CHANCE_MAX / 100F);
|
||||
else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * ((REPAIR_MASTERY_CHANCE_MAX) / 100F);
|
||||
|
||||
if (Permissions.repairMastery(player)) {
|
||||
bonus = repairAmount * bonus;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.api.SpoutToolsAPI;
|
||||
|
@ -1,12 +1,10 @@
|
||||
package com.gmail.nossr50.util.blockmeta.chunkmeta;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.Boolean;
|
||||
import java.lang.Integer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -18,11 +16,10 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.getspout.spoutapi.chunkstore.mcMMOSimpleRegionFile;
|
||||
|
||||
import com.gmail.nossr50.runnables.blockstoreconversion.BlockStoreConversionZDirectory;
|
||||
|
||||
import org.getspout.spoutapi.chunkstore.mcMMOSimpleRegionFile;
|
||||
|
||||
public class HashChunkManager implements ChunkManager {
|
||||
private HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>>();
|
||||
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
|
||||
@ -577,34 +574,41 @@ public class HashChunkManager implements ChunkManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawnedMob(Entity entity) {
|
||||
return spawnedMobs.contains(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawnedPet(Entity entity) {
|
||||
return spawnedMobs.contains(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpawnedMob(Entity entity) {
|
||||
if (!isSpawnedMob(entity))
|
||||
spawnedMobs.add(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpawnedPet(Entity entity) {
|
||||
if (!isSpawnedMob(entity))
|
||||
spawnedMobs.add(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpawnedMob(Entity entity) {
|
||||
if (isSpawnedMob(entity))
|
||||
spawnedMobs.remove(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpawnedPet(Entity entity) {
|
||||
if (isSpawnedMob(entity))
|
||||
spawnedMobs.remove(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void cleanMobLists() {
|
||||
if (!safeToRemoveMobs || iteratingMobs)
|
||||
return;
|
||||
|
@ -88,11 +88,18 @@ public class NullChunkManager implements ChunkManager {
|
||||
@Override
|
||||
public void cleanUp() {}
|
||||
|
||||
@Override
|
||||
public boolean isSpawnedMob(Entity entity) {return false;}
|
||||
@Override
|
||||
public boolean isSpawnedPet(Entity entity) {return false;}
|
||||
@Override
|
||||
public void addSpawnedMob(Entity entity) {}
|
||||
@Override
|
||||
public void addSpawnedPet(Entity entity) {}
|
||||
@Override
|
||||
public void removeSpawnedMob(Entity entity) {}
|
||||
@Override
|
||||
public void removeSpawnedPet(Entity entity) {}
|
||||
@Override
|
||||
public synchronized void cleanMobLists() {}
|
||||
}
|
@ -104,14 +104,17 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawnedMob(UUID id) {
|
||||
return spawnedMobs.contains(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawnedPet(UUID id) {
|
||||
return spawnedMobs.contains(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpawnedMob(UUID id) {
|
||||
if (!isSpawnedMob(id)) {
|
||||
spawnedMobs.add(id);
|
||||
@ -119,6 +122,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSpawnedPet(UUID id) {
|
||||
if (!isSpawnedPet(id)) {
|
||||
spawnedMobs.add(id);
|
||||
@ -126,6 +130,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpawnedMob(UUID id) {
|
||||
if (isSpawnedMob(id)) {
|
||||
spawnedMobs.remove(id);
|
||||
@ -133,6 +138,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSpawnedPet(UUID id) {
|
||||
if (isSpawnedPet(id)) {
|
||||
spawnedMobs.remove(id);
|
||||
@ -140,6 +146,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSpawnedMobs() {
|
||||
if (!spawnedMobs.isEmpty()) {
|
||||
spawnedMobs.clear();
|
||||
@ -147,6 +154,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSpawnedPets() {
|
||||
if (!spawnedMobs.isEmpty()) {
|
||||
spawnedMobs.clear();
|
||||
@ -154,10 +162,12 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UUID> getSpawnedMobs() {
|
||||
return spawnedMobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UUID> getSpawnedPets() {
|
||||
return spawnedMobs;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user