Added per-world playerdata, shortened package names
I disabled maven, for now, and commented out the dependencies, so I can continue working on the plugin. We can figure out that stuff later.
This commit is contained in:
parent
411acc51af
commit
6d88d023d6
16 changed files with 50 additions and 50 deletions
16
src/perworld/cache/CacheInterface.java
vendored
Normal file
16
src/perworld/cache/CacheInterface.java
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package perworld.cache;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
public interface CacheInterface {
|
||||||
|
|
||||||
|
public static ConfigurationSection worlds = perworld.main.MainPlugin.worlds;
|
||||||
|
public static ConfigurationSection players = perworld.main.MainPlugin.players;
|
||||||
|
|
||||||
|
Object generateElement(String string);
|
||||||
|
|
||||||
|
void putCache(String string);
|
||||||
|
|
||||||
|
void initCache();
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.cache;
|
package perworld.cache;
|
||||||
|
|
||||||
public class CacheRequestHandler {
|
public class CacheRequestHandler {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.cache.player;
|
package perworld.cache.player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
6
src/perworld/cache/player/Name.java
vendored
Normal file
6
src/perworld/cache/player/Name.java
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package perworld.cache.player;
|
||||||
|
|
||||||
|
public class Name {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package tbmc.perworld.cache.world;
|
package perworld.cache.world;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import tbmc.perworld.cache.CacheInterface;
|
import perworld.cache.CacheInterface;
|
||||||
|
|
||||||
public class ShareSettings implements CacheInterface {
|
public class ShareSettings implements CacheInterface {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.main;
|
package perworld.main;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.main;
|
package perworld.main;
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
|
@ -1,6 +1,6 @@
|
||||||
package tbmc.perworld.main;
|
package perworld.main;
|
||||||
|
|
||||||
import static tbmc.perworld.main.MainPlugin.debugClock;
|
import static perworld.main.MainPlugin.debugClock;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.main;
|
package perworld.main;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
@ -31,6 +31,6 @@ public class MainPlugin extends JavaPlugin {
|
||||||
worlds = config.getConfigurationSection("worlds");
|
worlds = config.getConfigurationSection("worlds");
|
||||||
players = config.getConfigurationSection("players");
|
players = config.getConfigurationSection("players");
|
||||||
|
|
||||||
new tbmc.perworld.cache.world.ShareSettings().initCache();
|
new perworld.cache.world.ShareSettings().initCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.main;
|
package perworld.main;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
|
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -7,10 +7,10 @@ import net.minecraft.server.v1_10_R1.IInventory;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static tbmc.perworld.cache.world.ShareSettings.compare;
|
import static perworld.cache.world.ShareSettings.compare;
|
||||||
import static tbmc.perworld.main.MainPlugin.debugClock;
|
import static perworld.main.MainPlugin.config;
|
||||||
import static tbmc.perworld.main.MainPlugin.plugin;
|
import static perworld.main.MainPlugin.debugClock;
|
||||||
import static tbmc.perworld.main.MainPlugin.config;
|
import static perworld.main.MainPlugin.plugin;
|
||||||
|
|
||||||
public class PlayerUpdater {
|
public class PlayerUpdater {
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ public class PlayerUpdater {
|
||||||
updatePlayerData(values, player);
|
updatePlayerData(values, player);
|
||||||
|
|
||||||
player.sendMessage("...done, " + (System.currentTimeMillis() - debugClock) + " ms");
|
player.sendMessage("...done, " + (System.currentTimeMillis() - debugClock) + " ms");
|
||||||
new tbmc.perworld.cache.world.ShareSettings().initCache();
|
new perworld.cache.world.ShareSettings().initCache();
|
||||||
player.sendMessage(tbmc.perworld.cache.world.ShareSettings.cache.keySet().stream().collect(Collectors.joining(",")));
|
player.sendMessage(perworld.cache.world.ShareSettings.cache.keySet().stream().collect(Collectors.joining(",")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class PlayerUpdater {
|
||||||
public static void updateLocation(Values values, Player player){
|
public static void updateLocation(Values values, Player player){
|
||||||
config.set(
|
config.set(
|
||||||
values.pFrom + ".location",
|
values.pFrom + ".location",
|
||||||
tbmc.perworld.serializers.location.serialize(player.getLocation())
|
perworld.serializers.location.serialize(player.getLocation())
|
||||||
);
|
);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
/* players are not automatically moved to their stored location,
|
/* players are not automatically moved to their stored location,
|
||||||
|
@ -78,18 +78,18 @@ public class PlayerUpdater {
|
||||||
//UPDATE INVENTORIES
|
//UPDATE INVENTORIES
|
||||||
public static void updateInventories(Values values, Player player){
|
public static void updateInventories(Values values, Player player){
|
||||||
IInventory inventory = ((CraftInventory) player.getInventory()).getInventory();
|
IInventory inventory = ((CraftInventory) player.getInventory()).getInventory();
|
||||||
config.set(values.pFrom + ".inventory", tbmc.perworld.serializers.inventory.serialize(inventory));
|
config.set(values.pFrom + ".inventory", perworld.serializers.inventory.serialize(inventory));
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
if (!values.shareinv)
|
if (!values.shareinv)
|
||||||
tbmc.perworld.serializers.inventory.setFromSerialized(
|
perworld.serializers.inventory.setFromSerialized(
|
||||||
inventory, config.getString(values.pTo + ".inventory")
|
inventory, config.getString(values.pTo + ".inventory")
|
||||||
);
|
);
|
||||||
|
|
||||||
IInventory enderchest = ((CraftInventory) player.getEnderChest()).getInventory();
|
IInventory enderchest = ((CraftInventory) player.getEnderChest()).getInventory();
|
||||||
config.set(values.pFrom + ".enderchest", tbmc.perworld.serializers.inventory.serialize(enderchest));
|
config.set(values.pFrom + ".enderchest", perworld.serializers.inventory.serialize(enderchest));
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
if (!values.shareinv)
|
if (!values.shareinv)
|
||||||
tbmc.perworld.serializers.inventory.setFromSerialized(
|
perworld.serializers.inventory.setFromSerialized(
|
||||||
enderchest, config.getString(values.pTo + ".enderchest")
|
enderchest, config.getString(values.pTo + ".enderchest")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -97,10 +97,10 @@ public class PlayerUpdater {
|
||||||
|
|
||||||
//UPDATE PLAYERDATA
|
//UPDATE PLAYERDATA
|
||||||
public static void updatePlayerData(Values values, Player player){
|
public static void updatePlayerData(Values values, Player player){
|
||||||
config.set(values.pFrom + ".playerdata", tbmc.perworld.serializers.playerdata.serialize(player));
|
config.set(values.pFrom + ".playerdata", perworld.serializers.playerdata.serialize(player));
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
if (!values.sharedata)
|
if (!values.sharedata)
|
||||||
tbmc.perworld.serializers.playerdata.setFromSerialized(
|
perworld.serializers.playerdata.setFromSerialized(
|
||||||
player, config.getString(values.pTo + ".playerdata")
|
player, config.getString(values.pTo + ".playerdata")
|
||||||
);
|
);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.main;
|
package perworld.main;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.serializers;
|
package perworld.serializers;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.serializers;
|
package perworld.serializers;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
|
@ -1,4 +1,4 @@
|
||||||
package tbmc.perworld.serializers;
|
package perworld.serializers;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
16
src/tbmc/perworld/cache/CacheInterface.java
vendored
16
src/tbmc/perworld/cache/CacheInterface.java
vendored
|
@ -1,16 +0,0 @@
|
||||||
package tbmc.perworld.cache;
|
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
|
|
||||||
public interface CacheInterface {
|
|
||||||
|
|
||||||
public static ConfigurationSection worlds = tbmc.perworld.main.MainPlugin.worlds;
|
|
||||||
public static ConfigurationSection players = tbmc.perworld.main.MainPlugin.players;
|
|
||||||
|
|
||||||
Object generateElement(String string);
|
|
||||||
|
|
||||||
void putCache(String string);
|
|
||||||
|
|
||||||
void initCache();
|
|
||||||
|
|
||||||
}
|
|
6
src/tbmc/perworld/cache/player/Name.java
vendored
6
src/tbmc/perworld/cache/player/Name.java
vendored
|
@ -1,6 +0,0 @@
|
||||||
package tbmc.perworld.cache.player;
|
|
||||||
|
|
||||||
public class Name {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue