Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onPlayerWorldRange(Player player) {
- Location location = player.getLocation();
- WorldPlots.count.put(player, 0);
- WorldPlots.confirmation.put(player, 0);
- try {
- for (String key : WorldPlots.config.getConfigurationSection("World").getKeys(false)) {
- int x1 = WorldPlots.config.getInt("World." + key + ".X1");
- int x2 = WorldPlots.config.getInt("World." + key + ".X2");
- int z1 = WorldPlots.config.getInt("World." + key + ".Z1");
- int z2 = WorldPlots.config.getInt("World." + key + ".Z2");
- int px = (int) location.getX();
- int pz = (int) location.getZ();
- int size = WorldPlots.config.getConfigurationSection("World").getKeys(false).size();
- int[] x = {x1, x2};
- int[] z = {z1, z2};
- Arrays.sort(x);
- Arrays.sort(z);
- if ((x[0] <= px) && (x[1] >= px-1) && (z[0] <= pz) && (z[1] >= pz-1)) {
- if (WorldPlots.nowPlayerRange.get(player).equalsIgnoreCase(key)) {
- StringBuilder string = new StringBuilder("");
- String length = WorldPlots.nowPlayerRange.get(player);
- for (int i=0; i<45-length.length(); i++) {
- string.append(" ");
- }
- player.sendTitle(length + string, "", 10, 60, 10);
- WorldPlots.nowPlayerRange.put(player, key);
- }
- WorldPlots.count.put(player, WorldPlots.count.get(player) + 1);
- WorldPlots.confirmation.put(player, 1);
- /*for (String key2 : WorldPlots.config.getConfigurationSection("World." + key + ".Land.Rental").getKeys(false)) {
- }*/
- }
- if ((size == WorldPlots.count.get(player)) && (WorldPlots.confirmation.get(player) == 0)) {
- if (WorldPlots.nowPlayerRange.get(player).equalsIgnoreCase(WorldPlots.config.getString("Title.OverWorld"))) {
- StringBuilder string = new StringBuilder("");
- String length = WorldPlots.nowPlayerRange.get(player);
- for (int i=0; i<45-length.length(); i++) {
- string.append(" ");
- }
- player.sendTitle(length + string, "", 10, 60, 10);
- }
- WorldPlots.nowPlayerRange.put(player, WorldPlots.config.getString("Title.OverWorld"));
- }
- }
- } catch (NullPointerException ei) {
- if (WorldPlots.nowPlayerRange.get(player).equalsIgnoreCase(WorldPlots.config.getString("Title.OverWorld"))) {
- StringBuilder string = new StringBuilder("");
- String length = WorldPlots.nowPlayerRange.get(player);
- for (int i=0; i<45-length.length(); i++) {
- string.append(" ");
- }
- player.sendTitle(length + string, "", 10, 60, 10);
- }
- WorldPlots.nowPlayerRange.put(player, WorldPlots.config.getString("Title.OverWorld"));
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement