mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-27 19:24:43 +02:00
StringMan instead of StringUtils
This commit is contained in:
@ -93,8 +93,8 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
|
||||
public void cleanChunk(final Chunk chunk) {
|
||||
TaskManager.index.increment();
|
||||
final Integer currentIndex = TaskManager.index.toInteger();
|
||||
TaskManager.index.incrementAndGet();
|
||||
final Integer currentIndex = TaskManager.index.get();
|
||||
final Integer task = TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -10,7 +10,6 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
@ -112,6 +111,7 @@ import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.RegExUtil;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
@ -304,7 +304,7 @@ public class PlayerEvents extends com.plotsquared.bukkit.listeners.PlotListener
|
||||
if (split[0].equals("plotme") || split[0].equals("ap")) {
|
||||
final Player player = event.getPlayer();
|
||||
if (Settings.USE_PLOTME_ALIAS) {
|
||||
player.performCommand("plots " + StringUtils.join(Arrays.copyOfRange(split, 1, split.length), " "));
|
||||
player.performCommand("plots " + StringMan.join(Arrays.copyOfRange(split, 1, split.length), " "));
|
||||
} else {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import com.intellectualcrafters.plot.object.schematic.ItemType;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
@ -19,7 +19,9 @@ import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.jnbt.ListTag;
|
||||
import com.intellectualcrafters.jnbt.ShortTag;
|
||||
import com.intellectualcrafters.jnbt.Tag;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
public class StateWrapper {
|
||||
|
||||
@ -48,7 +50,7 @@ public class StateWrapper {
|
||||
CompoundTag itemComp = (CompoundTag) itemTag;
|
||||
short id = itemComp.getShort("id");
|
||||
String idStr = itemComp.getString("id");
|
||||
if (!StringUtils.isNumeric(idStr) && idStr != null) {
|
||||
if (idStr != null && !MathMan.isInteger(idStr)) {
|
||||
idStr = idStr.split(":")[1].toLowerCase();
|
||||
id = (short) ItemType.getId(idStr);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
import org.apache.commons.lang.mutable.MutableInt;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -64,6 +63,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class BukkitChunkManager extends ChunkManager {
|
||||
@Override
|
||||
@ -193,7 +193,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
*/
|
||||
@Override
|
||||
public boolean copyRegion(final Location pos1, final Location pos2, final Location newPos, final Runnable whenDone) {
|
||||
TaskManager.index.increment();
|
||||
TaskManager.index.incrementAndGet();
|
||||
final int relX = newPos.getX() - pos1.getX();
|
||||
final int relZ = newPos.getZ() - pos1.getZ();
|
||||
|
||||
@ -224,7 +224,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
}
|
||||
final Plugin plugin = BukkitMain.THIS;
|
||||
final Integer currentIndex = TaskManager.index.toInteger();
|
||||
final Integer currentIndex = TaskManager.index.get();
|
||||
final int loadTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -236,7 +236,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TaskManager.index.increment();
|
||||
TaskManager.index.incrementAndGet();
|
||||
// Copy entities
|
||||
initMaps();
|
||||
for (int x = c1x; x <= c2x; x++) {
|
||||
@ -247,8 +247,8 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
}
|
||||
// Copy blocks
|
||||
final MutableInt mx = new MutableInt(sx);
|
||||
final Integer currentIndex = TaskManager.index.toInteger();
|
||||
final AtomicInteger mx = new AtomicInteger(sx);
|
||||
final Integer currentIndex = TaskManager.index.get();
|
||||
final int maxY = oldWorld.getMaxHeight();
|
||||
final Integer task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||
@Override
|
||||
@ -265,7 +265,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
BukkitSetBlockManager.setBlockManager.set(newWorld, xv + relX, y, z + relZ, id, data);
|
||||
}
|
||||
}
|
||||
mx.increment();
|
||||
mx.incrementAndGet();
|
||||
if (xv == ex) { // done!
|
||||
for (int x = c1x; x <= c2x; x++) {
|
||||
for (int z = c1z; z <= c2z; z++) {
|
||||
|
@ -4,7 +4,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
@ -35,6 +34,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
|
||||
public class BukkitUtil extends BlockManager {
|
||||
@ -380,7 +380,7 @@ public class BukkitUtil extends BlockManager {
|
||||
else {
|
||||
data = 0;
|
||||
}
|
||||
if (StringUtils.isNumeric(split[0])) {
|
||||
if (MathMan.isInteger(split[0])) {
|
||||
id = Short.parseShort(split[0]);
|
||||
match = 0;
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
package com.plotsquared.sponge;
|
||||
|
||||
import org.spongepowered.api.world.gen.WorldGenerator;
|
||||
|
||||
import com.intellectualcrafters.plot.generator.PlotGenerator2;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
|
||||
public class SpongeGeneratorWrapper extends PlotGenerator2<WorldGenerator>{
|
||||
|
||||
public SpongeGeneratorWrapper(String world, WorldGenerator generator) {
|
||||
super(world, generator);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(PlotWorld plotworld) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void augment(PlotCluster cluster, PlotWorld plotworld) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGenerator(String generator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotWorld getNewPlotWorld(String world) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotManager getPlotManager() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,6 @@ import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.api.Game;
|
||||
import org.spongepowered.api.Server;
|
||||
@ -14,12 +13,14 @@ import org.spongepowered.api.event.Subscribe;
|
||||
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
|
||||
import org.spongepowered.api.event.state.PreInitializationEvent;
|
||||
import org.spongepowered.api.event.state.ServerAboutToStartEvent;
|
||||
import org.spongepowered.api.plugin.Plugin;
|
||||
import org.spongepowered.api.plugin.PluginContainer;
|
||||
import org.spongepowered.api.world.DimensionTypes;
|
||||
import org.spongepowered.api.world.GeneratorTypes;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||
import com.intellectualcrafters.plot.IPlotMain;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
@ -42,7 +43,7 @@ import com.plotsquared.bukkit.util.UUIDHandler;
|
||||
* Created by robin on 01/11/2014
|
||||
*/
|
||||
|
||||
//@Plugin(id = "PlotSquared", name = "PlotSquared", version = "3.0.0")
|
||||
@Plugin(id = "PlotSquared", name = "PlotSquared", version = "3.0.0")
|
||||
public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
public static SpongeMain THIS;
|
||||
|
||||
@ -84,8 +85,16 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
///////////////////// ON ENABLE /////////////////////
|
||||
@Subscribe
|
||||
public void onInit(PreInitializationEvent event) {
|
||||
log("PRE INIT");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onServerAboutToStart(ServerAboutToStartEvent event) {
|
||||
log("INIT");
|
||||
THIS = this;
|
||||
PS.instance = new PS(this);
|
||||
|
||||
// Setup metrics
|
||||
if (Settings.METRICS) {
|
||||
try {
|
||||
final SpongeMetrics metrics = new SpongeMetrics(game, this);
|
||||
@ -97,31 +106,35 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
} else {
|
||||
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
|
||||
}
|
||||
|
||||
// Set the generators for each world...
|
||||
server = game.getServer();
|
||||
Collection<World> worlds = server.getWorlds();
|
||||
if (worlds.size() > 0) {
|
||||
log("INJECTING WORLDS!!!!!!!");
|
||||
UUIDHandler.startCaching();
|
||||
for (World world : server.getWorlds()) {
|
||||
log("INJECTING WORLD: " + world.getName());
|
||||
world.setWorldGenerator(new SpongePlotGenerator(world.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onServerAboutToStart(ServerAboutToStartEvent event) {
|
||||
this.modify = new WorldModify(this);
|
||||
Game game = event.getGame();
|
||||
game.getRegistry().registerWorldGeneratorModifier(modify);
|
||||
game.getRegistry().getWorldBuilder()
|
||||
.name("test")
|
||||
.enabled(true)
|
||||
.loadsOnStartup(true)
|
||||
.keepsSpawnLoaded(true)
|
||||
.dimensionType(DimensionTypes.OVERWORLD)
|
||||
.generator(GeneratorTypes.DEBUG)
|
||||
.gameMode(GameModes.CREATIVE)
|
||||
.generatorModifiers(modify)
|
||||
.build();
|
||||
|
||||
ConfigurationSection worldSection = PS.get().config.getConfigurationSection("worlds");
|
||||
for (String world : worldSection.getKeys(false)) {
|
||||
this.modify = new WorldModify(this);
|
||||
Game game = event.getGame();
|
||||
game.getRegistry().registerWorldGeneratorModifier(modify);
|
||||
game.getRegistry().getWorldBuilder()
|
||||
.name(world)
|
||||
.enabled(true)
|
||||
.loadsOnStartup(true)
|
||||
.keepsSpawnLoaded(true)
|
||||
.dimensionType(DimensionTypes.OVERWORLD)
|
||||
.generator(GeneratorTypes.DEBUG)
|
||||
.gameMode(GameModes.CREATIVE)
|
||||
.generatorModifiers(modify)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
@ -288,7 +301,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getGenerator(String world, String name) {
|
||||
public SpongeGeneratorWrapper getGenerator(String world, String name) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user