mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
Merge branch 'master' of http://git.intellectualsites.com/citymonstret/plot_new
Conflicts: PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
This commit is contained in:
@ -1,23 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="IntelliGuard" name="Obfuscation">
|
||||
<configuration>
|
||||
<option name="yGuardJar" value="C:\Users\Citymonstret\Desktop\lib\yguard.jar" />
|
||||
<option name="mainclass" value="com.intellectualcrafters.plot.PlotMain" />
|
||||
<option name="errorChecking" value="false" />
|
||||
<option name="jarConfig">
|
||||
<JarConfig>
|
||||
<option name="jarEntries">
|
||||
<list>
|
||||
<option value="C:\Users\Citymonstret\Desktop\workspace\bukkit\plot_news\out\production\PlotSquared" />
|
||||
</list>
|
||||
</option>
|
||||
</JarConfig>
|
||||
</option>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
|
@ -1,21 +1,15 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.command.defaults.SaveCommand;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static com.intellectualcrafters.plot.PlotWorld.*;
|
||||
@ -77,15 +71,15 @@ public class WorldGenerator extends ChunkGenerator {
|
||||
options.put("worlds."+world+".plot_biome", PLOT_BIOME_DEFAULT);
|
||||
options.put("worlds."+world+".plot_filling", Arrays.asList(MAIN_BLOCK_DEFAULT));
|
||||
options.put("worlds."+world+".top_floor", Arrays.asList(TOP_BLOCK_DEFAULT));
|
||||
options.put("worlds."+world+".wall_block", WALL_BLOCK_DEFAULT);
|
||||
options.put("worlds."+world+".road_width", ROAD_WIDTH_DEFAULT);
|
||||
options.put("worlds."+world+".road_height", ROAD_HEIGHT_DEFAULT);
|
||||
options.put("worlds."+world+".road_block", ROAD_BLOCK_DEFAULT);
|
||||
options.put("worlds."+world+".road_stripes", ROAD_STRIPES_DEFAULT);
|
||||
options.put("worlds."+world+".wall_filling", WALL_FILLING_DEFAULT);
|
||||
options.put("worlds."+world+".wall_height", WALL_HEIGHT_DEFAULT);
|
||||
options.put("worlds."+world+".schematic_on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
||||
options.put("worlds."+world+".schematic_file", SCHEMATIC_FILE_DEFAULT);
|
||||
options.put("worlds."+world+".wall.block", WALL_BLOCK_DEFAULT);
|
||||
options.put("worlds."+world+".road.width", ROAD_WIDTH_DEFAULT);
|
||||
options.put("worlds."+world+".road.height", ROAD_HEIGHT_DEFAULT);
|
||||
options.put("worlds."+world+".road.block", ROAD_BLOCK_DEFAULT);
|
||||
options.put("worlds."+world+".road.stripes", ROAD_STRIPES_DEFAULT);
|
||||
options.put("worlds."+world+".wall.filling", WALL_FILLING_DEFAULT);
|
||||
options.put("worlds."+world+".wall.height", WALL_HEIGHT_DEFAULT);
|
||||
options.put("worlds."+world+".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
||||
options.put("worlds."+world+".schematic.file", SCHEMATIC_FILE_DEFAULT);
|
||||
options.put("worlds."+world+".default_flags", DEFAULT_FLAGS_DEFAULT);
|
||||
|
||||
for (Entry<String, Object> node : options.entrySet()) {
|
||||
@ -103,16 +97,16 @@ public class WorldGenerator extends ChunkGenerator {
|
||||
plotworld.PLOT_BIOME = config.getString("worlds."+world+".plot_biome");
|
||||
plotworld.MAIN_BLOCK = config.getStringList("worlds."+world+".plot_filling").toArray(new String[0]);
|
||||
plotworld.TOP_BLOCK = config.getStringList("worlds."+world+".top_floor").toArray(new String[0]);
|
||||
plotworld.WALL_BLOCK = config.getString("worlds."+world+".wall_block");
|
||||
plotworld.ROAD_WIDTH = config.getInt("worlds."+world+".road_width");
|
||||
plotworld.ROAD_HEIGHT = config.getInt("worlds."+world+".road_height");
|
||||
plotworld.ROAD_BLOCK = config.getString("worlds."+world+".road_block");
|
||||
plotworld.ROAD_STRIPES = config.getString("worlds."+world+".road_stripes");
|
||||
plotworld.WALL_FILLING = config.getString("worlds."+world+".wall_filling");
|
||||
plotworld.WALL_HEIGHT = config.getInt("worlds."+world+".wall_height");
|
||||
plotworld.WALL_BLOCK = config.getString("worlds."+world+".wall.block");
|
||||
plotworld.ROAD_WIDTH = config.getInt("worlds."+world+".road.width");
|
||||
plotworld.ROAD_HEIGHT = config.getInt("worlds."+world+".road.height");
|
||||
plotworld.ROAD_BLOCK = config.getString("worlds."+world+".road.block");
|
||||
plotworld.ROAD_STRIPES = config.getString("worlds."+world+".road.stripes");
|
||||
plotworld.WALL_FILLING = config.getString("worlds."+world+".wall.filling");
|
||||
plotworld.WALL_HEIGHT = config.getInt("worlds."+world+".wall.height");
|
||||
plotworld.PLOT_CHAT = config.getBoolean("worlds."+world+".plot_chat");
|
||||
plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds."+world+".schematic_on_claim");
|
||||
plotworld.SCHEMATIC_FILE = config.getString("worlds."+world+".schematic_file");
|
||||
plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds."+world+".schematic.on_claim");
|
||||
plotworld.SCHEMATIC_FILE = config.getString("worlds."+world+".schematic.file");
|
||||
|
||||
String[] default_flags_string = config.getStringList("worlds."+world+".default_flags").toArray(new String[0]);
|
||||
Flag[] default_flags = new Flag[default_flags_string.length];
|
||||
|
@ -14,10 +14,7 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
@ -267,6 +264,43 @@ public class DBFunc {
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||
try {
|
||||
DatabaseMetaData data = connection.getMetaData();
|
||||
ResultSet rs = data.getColumns(null, null, "plot", "plot_id");
|
||||
boolean execute = rs.next();
|
||||
if(execute) {
|
||||
Statement statement = connection.createStatement();
|
||||
statement.addBatch(
|
||||
"ALTER IGNORE TABLE `plot` ADD `plot_id_x` int(11) DEFAULT 0"
|
||||
);
|
||||
statement.addBatch(
|
||||
"ALTER IGNORE TABLE `plot` ADD `plot_id_z` int(11) DEFAULT 0"
|
||||
);
|
||||
statement.addBatch(
|
||||
"UPDATE `plot` SET\n" +
|
||||
" `plot_id_x` = IF(" +
|
||||
" LOCATE(';', `plot_id`) > 0," +
|
||||
" SUBSTRING(`plot_id`, 1, LOCATE(';', `plot_id`) - 1)," +
|
||||
" `plot_id`" +
|
||||
" )," +
|
||||
" `plot_id_z` = IF(" +
|
||||
" LOCATE(';', `plot_id`) > 0," +
|
||||
" SUBSTRING(`plot_id`, LOCATE(';', `plot_id`) + 1)," +
|
||||
" NULL" +
|
||||
" )"
|
||||
);
|
||||
statement.addBatch(
|
||||
"ALTER TABLE `plot` DROP `plot_id`"
|
||||
);
|
||||
statement.addBatch(
|
||||
"ALTER IGNORE TABLE `plot_settings` ADD `flags` VARCHAR(512) DEFAULT NULL"
|
||||
);
|
||||
statement.executeBatch();
|
||||
statement.close();
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
HashMap<String, HashMap<PlotId, Plot>> plots = new HashMap<String, HashMap<PlotId, Plot>>();
|
||||
HashMap<String, World> worldMap = new HashMap<String, World>();
|
||||
Statement stmt = null;
|
||||
|
Reference in New Issue
Block a user