mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-27 11:14:43 +02:00
Fixed some items on the to-do list.
This commit is contained in:
@ -9,19 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.sk89q.worldedit.blocks.ClothColor.ID;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -442,10 +440,10 @@ public class PlotHelper {
|
||||
return x;
|
||||
}
|
||||
|
||||
public static double getWorldFolderSize() {
|
||||
// long size =
|
||||
// FileUtils.sizeOfDirectory(Bukkit.getWorld(Settings.PLOT_WORLD).getWorldFolder());
|
||||
long size = 10;
|
||||
public static double getWorldFolderSize(World world) {
|
||||
//long size = FileUtil.sizeOfDirectory(world.getWorldFolder());
|
||||
File folder = world.getWorldFolder();
|
||||
long size = folder.length();
|
||||
return (((size) / 1024) / 1024);
|
||||
}
|
||||
|
||||
@ -727,7 +725,23 @@ public class PlotHelper {
|
||||
}
|
||||
return new short[] { Short.parseShort(block), 0 };
|
||||
}
|
||||
|
||||
|
||||
public static void teleportPlayers(World world, Plot plot, boolean tile) {
|
||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||
for (int i = (pos2.getBlockX() / 16) * 16; i < 16 + (pos2. getBlockX() / 16) * 16; i= 16) {
|
||||
for (int j = (pos1. getBlockZ() / 16) * 16; j < 16 + (pos2.getBlockZ() / 16) * 16; j += 16) {
|
||||
Chunk chunk = world.getChunkAt(i, j);
|
||||
for (Entity entity : chunk.getEntities()) {
|
||||
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||
if(id != null && id.equals(plot.id) && entity.getType() == EntityType.PLAYER) {
|
||||
entity.teleport(world.getSpawnLocation());
|
||||
// Should this teleport them to floor instead?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void clearAllEntities(World world, Plot plot, boolean tile) {
|
||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||
@ -755,15 +769,15 @@ public class PlotHelper {
|
||||
* @param plot
|
||||
*/
|
||||
public static void clear(final Player requester, final Plot plot) {
|
||||
|
||||
// TODO teleport any players underground to the surface
|
||||
|
||||
|
||||
final long start = System.nanoTime();
|
||||
final World world = requester.getWorld();
|
||||
|
||||
// clear entities:
|
||||
clearAllEntities(world, plot, false);
|
||||
|
||||
//teleport players
|
||||
teleportPlayers(world, plot, false);
|
||||
|
||||
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
||||
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
|
||||
|
@ -110,10 +110,6 @@ public class PlotMain extends JavaPlugin {
|
||||
return new WorldGenerator(worldname);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Implement better system
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void checkForExpiredPlots() {
|
||||
final JavaPlugin plugin = PlotMain.getMain();
|
||||
@ -488,7 +484,6 @@ public class PlotMain extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO make this configurable
|
||||
PlotWorld.BLOCKS = new ArrayList<>(Arrays.asList(new Material[] { ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND, SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK,
|
||||
SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126) }));
|
||||
if (Settings.KILL_ROAD_MOBS) {
|
||||
|
@ -81,7 +81,7 @@ public class Settings {
|
||||
*
|
||||
*/
|
||||
public static class DB {
|
||||
public static boolean USE_MONGO = false; /* TODO: Implement Mongo */;
|
||||
public static boolean USE_MONGO = false; /* TODO: Implement Mongo @Brandon */;
|
||||
public static boolean USE_SQLITE = false;
|
||||
public static boolean USE_MYSQL = true; /* NOTE: Fixed connector */
|
||||
public static String SQLITE_DB = "storage";
|
||||
|
@ -93,6 +93,7 @@ public class Auto extends SubCommand {
|
||||
PlotId end = new PlotId(x+size_x-1, z+size_z-1);
|
||||
if (isUnowned(world, start, end)) {
|
||||
// TODO claim event
|
||||
// Claim.claimPlot calls that event...
|
||||
for (int i = start.x; i <= end.x; i++) {
|
||||
for (int j = start.y; j <= end.y; j++) {
|
||||
Plot plot = PlotHelper.getPlot(world, new PlotId(i,j));
|
||||
|
@ -9,15 +9,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.Lag;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotHelper;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.RUtils;
|
||||
|
||||
/**
|
||||
* @author Citymonstret \\SuperCharged Compiler made by Citymonstret\\
|
||||
* ||#Compiler:ALPHA-1.0#########################
|
||||
@ -85,7 +80,10 @@ public class Debug extends SubCommand {
|
||||
information.append(getSection(section, "PlotWorld"));
|
||||
information.append(getLine(line, "Plot Worlds", worlds));
|
||||
information.append(getLine(line, "Owned Plots", PlotMain.getPlots().size()));
|
||||
information.append(getLine(line, "PlotWorld Size", PlotHelper.getWorldFolderSize() + "MB"));
|
||||
//information.append(getLine(line, "PlotWorld Size", PlotHelper.getWorldFolderSize() + "MB"));
|
||||
for(String world : PlotMain.getPlotWorlds()) {
|
||||
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(Bukkit.getWorld(world))));
|
||||
}
|
||||
information.append(getLine(line, "Entities", PlotHelper.getEntities(plr.getWorld())));
|
||||
information.append(getLine(line, "Loaded Tile Entities", PlotHelper.getTileEntities(plr.getWorld())));
|
||||
information.append(getLine(line, "Loaded Chunks", PlotHelper.getLoadedChunks(plr.getWorld())));
|
||||
|
@ -9,9 +9,11 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotHelper;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -20,11 +22,8 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotHelper;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -92,8 +91,8 @@ public class Info extends SubCommand {
|
||||
info = info.replaceAll("%trusted%", getPlayerList(plot.trusted));
|
||||
info = info.replaceAll("%denied%", getPlayerList(plot.denied));
|
||||
info = info.replaceAll("%flags%", StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), ",") : "none");
|
||||
PlayerFunctions.sendMessage(player, PlayerFunctions.getTopPlot(player.getWorld(), plot).id.toString());
|
||||
PlayerFunctions.sendMessage(player, PlayerFunctions.getBottomPlot(player.getWorld(), plot).id.toString());
|
||||
//PlayerFunctions.sendMessage(player, PlayerFunctions.getTopPlot(player.getWorld(), plot).id.toString());
|
||||
//PlayerFunctions.sendMessage(player, PlayerFunctions.getBottomPlot(player.getWorld(), plot).id.toString());
|
||||
PlayerFunctions.sendMessage(player, info);
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import com.intellectualcrafters.plot.PlotMain;
|
||||
*/
|
||||
public class DBFunc {
|
||||
|
||||
// TODO MongoDB
|
||||
// TODO MongoDB @Brandon
|
||||
|
||||
/**
|
||||
* Set Plot owner
|
||||
|
@ -1,5 +1,14 @@
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.worldcretornica.plotme.PlayerList;
|
||||
import com.worldcretornica.plotme.Plot;
|
||||
import com.worldcretornica.plotme.PlotManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
@ -7,19 +16,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.api.PlotAPI;
|
||||
import com.sun.org.apache.xerces.internal.impl.dv.DVFactoryException;
|
||||
import com.worldcretornica.plotme.PlayerList;
|
||||
import com.worldcretornica.plotme.Plot;
|
||||
import com.worldcretornica.plotme.PlotManager;
|
||||
import com.worldcretornica.plotme.PlotMe;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-17.
|
||||
*/
|
||||
@ -32,6 +28,10 @@ public class PlotMeConverter {
|
||||
}
|
||||
|
||||
public void runAsync() throws Exception {
|
||||
|
||||
/* TODO Fix this... */
|
||||
boolean offlineMode = Bukkit.getOnlineMode();
|
||||
|
||||
final PrintStream stream = new PrintStream("converter_log.txt");
|
||||
|
||||
PlotMain.sendConsoleSenderMessage("PlotMe->PlotSquared Conversion has started");
|
||||
@ -174,7 +174,8 @@ public class PlotMeConverter {
|
||||
|
||||
// TODO disable PlotMe -> Unload all plot worlds, change the generator, restart the server automatically
|
||||
// Possibly use multiverse / multiworld if it's to difficult modifying a world's generator while the server is running
|
||||
|
||||
// Should really do that? Would seem pretty bad from our side + bukkit wouldn't approve
|
||||
|
||||
Bukkit.getPluginManager().disablePlugin(PlotMeConverter.this.plugin);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user