mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
Merge remote-tracking branch 'origin/master'
Conflicts: PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
This commit is contained in:
@ -25,7 +25,7 @@ public enum C {
|
||||
/*
|
||||
* Economy Stuff
|
||||
*/
|
||||
CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), REMOVED_BALANCE("&6%s &chas been taken from your balance"),
|
||||
CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), ADDED_BALANCE("&6%s &chas been added to your balance"), REMOVED_BALANCE("&6%s &chas been taken from your balance"),
|
||||
/*
|
||||
* Setup Stuff
|
||||
*/
|
||||
|
@ -7,7 +7,38 @@ import org.bukkit.ChatColor;
|
||||
*/
|
||||
public class ConsoleColors {
|
||||
|
||||
public static final String ANSI_RESET = "\u001B[0m";
|
||||
static enum ConsoleColor {
|
||||
RESET ("\u001B[0m"),
|
||||
BLACK ("\u001B[30m"),
|
||||
RED ("\u001B[31m"),
|
||||
GREEN ("\u001B[32m"),
|
||||
YELLOW ("\u001B[33m"),
|
||||
BLUE ("\u001B[34m"),
|
||||
PURPLE ("\u001B[35m"),
|
||||
CYAN ("\u001B[36m"),
|
||||
WHITE ("\u001B[37m"),
|
||||
BOLD ("\033[1m"),
|
||||
UNDERLINE ("\033[0m"),
|
||||
ITALIC ("\033[3m");
|
||||
|
||||
private String win;
|
||||
private String lin;
|
||||
|
||||
ConsoleColor(String lin) {
|
||||
this.lin = lin;
|
||||
this.win = win;
|
||||
}
|
||||
|
||||
public String getWin() {
|
||||
return win;
|
||||
}
|
||||
|
||||
public String getLin(){
|
||||
return lin;
|
||||
}
|
||||
}
|
||||
|
||||
/* public static final String ANSI_RESET = "\u001B[0m";
|
||||
public static final String ANSI_BLACK = "\u001B[30m";
|
||||
public static final String ANSI_RED = "\u001B[31m";
|
||||
public static final String ANSI_GREEN = "\u001B[32m";
|
||||
@ -18,49 +49,53 @@ public class ConsoleColors {
|
||||
public static final String ANSI_WHITE = "\u001B[37m";
|
||||
public static final String ANSI_BOLD = "\033[1m";
|
||||
public static final String ANSI_UNDERLINE = "\033[0m";
|
||||
public static final String ANSI_ITALIC = "\033[3m]";
|
||||
public static final String ANSI_ITALIC = "\033[3m]";*/
|
||||
|
||||
public static String fromString(String input) {
|
||||
input = input.replaceAll("&0", fromChatColor(ChatColor.BLACK)).replaceAll("&1", fromChatColor(ChatColor.DARK_BLUE)).replaceAll("&2", fromChatColor(ChatColor.DARK_GREEN)).replaceAll("&3", fromChatColor(ChatColor.DARK_AQUA)).replaceAll("&4", fromChatColor(ChatColor.DARK_RED)).replaceAll("&5", fromChatColor(ChatColor.DARK_PURPLE)).replaceAll("&6", fromChatColor(ChatColor.GOLD)).replaceAll("&7", fromChatColor(ChatColor.GRAY)).replaceAll("&8", fromChatColor(ChatColor.DARK_GRAY)).replaceAll("&9", fromChatColor(ChatColor.BLUE)).replaceAll("&a", fromChatColor(ChatColor.GREEN)).replaceAll("&b", fromChatColor(ChatColor.AQUA)).replaceAll("&c", fromChatColor(ChatColor.RED)).replaceAll("&d", fromChatColor(ChatColor.LIGHT_PURPLE)).replaceAll("&e", fromChatColor(ChatColor.YELLOW)).replaceAll("&f", fromChatColor(ChatColor.WHITE)).replaceAll("&k", fromChatColor(ChatColor.MAGIC)).replaceAll("&l", fromChatColor(ChatColor.BOLD)).replaceAll("&m", fromChatColor(ChatColor.STRIKETHROUGH))
|
||||
.replaceAll("&n", fromChatColor(ChatColor.UNDERLINE)).replaceAll("&o", fromChatColor(ChatColor.ITALIC)).replaceAll("&r", fromChatColor(ChatColor.RESET));
|
||||
return input + ANSI_RESET;
|
||||
return input + ConsoleColor.RESET.toString();
|
||||
}
|
||||
|
||||
public static String fromChatColor(ChatColor color) {
|
||||
return chatColor(color).getLin();
|
||||
}
|
||||
|
||||
public static ConsoleColor chatColor(ChatColor color) {
|
||||
switch (color) {
|
||||
case RESET:
|
||||
return ANSI_RESET;
|
||||
return ConsoleColor.RESET;
|
||||
case GRAY:
|
||||
case DARK_GRAY:
|
||||
return ANSI_WHITE;
|
||||
return ConsoleColor.WHITE;
|
||||
case BLACK:
|
||||
return ANSI_BLACK;
|
||||
return ConsoleColor.BLACK;
|
||||
case DARK_RED:
|
||||
case RED:
|
||||
return ANSI_RED;
|
||||
return ConsoleColor.RED;
|
||||
case GOLD:
|
||||
case YELLOW:
|
||||
return ANSI_YELLOW;
|
||||
return ConsoleColor.YELLOW;
|
||||
case DARK_GREEN:
|
||||
case GREEN:
|
||||
return ANSI_GREEN;
|
||||
return ConsoleColor.GREEN;
|
||||
case AQUA:
|
||||
case DARK_AQUA:
|
||||
return ANSI_CYAN;
|
||||
return ConsoleColor.CYAN;
|
||||
case LIGHT_PURPLE:
|
||||
case DARK_PURPLE:
|
||||
return ANSI_PURPLE;
|
||||
return ConsoleColor.PURPLE;
|
||||
case BLUE:
|
||||
case DARK_BLUE:
|
||||
return ANSI_BLUE;
|
||||
return ConsoleColor.BLUE;
|
||||
case UNDERLINE:
|
||||
return ANSI_UNDERLINE;
|
||||
return ConsoleColor.UNDERLINE;
|
||||
case ITALIC:
|
||||
return ANSI_ITALIC;
|
||||
return ConsoleColor.ITALIC;
|
||||
case BOLD:
|
||||
return ANSI_BOLD;
|
||||
return ConsoleColor.BOLD;
|
||||
default:
|
||||
return "";
|
||||
return ConsoleColor.RESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,19 +9,9 @@
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -29,7 +19,8 @@ import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* plot functions
|
||||
@ -48,7 +39,7 @@ public class PlotHelper {
|
||||
/**
|
||||
* direction 0 = north, 1 = south, etc:
|
||||
*
|
||||
* @param plot
|
||||
* @param id
|
||||
* @param direction
|
||||
* @return
|
||||
*/
|
||||
@ -66,6 +57,23 @@ public class PlotHelper {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static boolean mergePlots(Player plr, World world, ArrayList<PlotId> plotIds) {
|
||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||
if(PlotMain.useEconomy && plotworld.USE_ECONOMY) {
|
||||
double cost = plotIds.size() * plotworld.MERGE_PRICE;
|
||||
if (cost > 0d) {
|
||||
Economy economy = PlotMain.economy;
|
||||
if (economy.getBalance(plr) < cost) {
|
||||
PlayerFunctions.sendMessage(plr, C.CANNOT_AFFORD_MERGE, "" + cost);
|
||||
return false;
|
||||
}
|
||||
economy.withdrawPlayer(plr, cost);
|
||||
PlayerFunctions.sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||
}
|
||||
}
|
||||
return mergePlots(world, plotIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Completely merges a set of plots<br>
|
||||
* <b>(There are no checks to make sure you supply the correct
|
||||
|
@ -490,8 +490,8 @@ public class PlotMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Implement better system The whole point of this system is to
|
||||
* recycle old plots So why not just allow users to claim old plots, and try
|
||||
* TODO: Implement better system
|
||||
* The whole point of this system is to recycle old plots So why not just allow users to claim old plots, and try
|
||||
* to hide the fact that the are owned. Reduce amount of expired plots: - On
|
||||
* /plot auto - allow claiming of old plot, clear it so the user doesn't
|
||||
* know - On /plot info, - show that the plot is expired and allowed to be
|
||||
@ -752,8 +752,8 @@ public class PlotMain extends JavaPlugin {
|
||||
PlotHelper.canSetFast = false;
|
||||
}
|
||||
|
||||
|
||||
// UUIDHandler.startFetch(this);
|
||||
//TODO Test...
|
||||
UUIDHandler.startFetch(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,10 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||
|
||||
public abstract class PlotWorld {
|
||||
|
||||
public boolean AUTO_MERGE;
|
||||
@ -110,4 +106,4 @@ public abstract class PlotWorld {
|
||||
* @return ConfigurationNode[]
|
||||
*/
|
||||
public abstract ConfigurationNode[] getSettingNodes();
|
||||
}
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.intellectualcrafters.plot.uuid.NameFetcher;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -71,7 +74,13 @@ public class UUIDHandler {
|
||||
return uuid;
|
||||
}
|
||||
if(Bukkit.getOnlineMode()) {
|
||||
/* TODO: Add mojang API support */
|
||||
try {
|
||||
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
|
||||
uuid = fetcher.call().get(name);
|
||||
add(name, uuid);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
return getUuidOfflineMode(name);
|
||||
}
|
||||
@ -108,7 +117,19 @@ public class UUIDHandler {
|
||||
if ((name = getNameOfflinePlayer(uuid)) != null) {
|
||||
return name;
|
||||
}
|
||||
return null;
|
||||
if (Bukkit.getOnlineMode()) {
|
||||
try {
|
||||
NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
|
||||
name = fetcher.call().get(uuid);
|
||||
add(name, uuid);
|
||||
return name;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,6 +70,7 @@ public class Auto extends SubCommand {
|
||||
PlotWorld pWorld = PlotMain.getWorldSettings(world);
|
||||
if(PlotMain.useEconomy && pWorld.USE_ECONOMY) {
|
||||
double cost = pWorld.PLOT_PRICE;
|
||||
cost = (size_x * size_z) * cost;
|
||||
if (cost > 0d) {
|
||||
Economy economy = PlotMain.economy;
|
||||
if (economy.getBalance(plr) < cost) {
|
||||
@ -119,16 +120,16 @@ public class Auto extends SubCommand {
|
||||
PlotId start = new PlotId(x, z);
|
||||
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));
|
||||
boolean teleport = ((i == end.x) && (j == end.y)) ? true : false;
|
||||
boolean teleport = ((i == end.x) && (j == end.y));
|
||||
Claim.claimPlot(plr, plot, teleport);
|
||||
}
|
||||
}
|
||||
PlotHelper.mergePlots(world, PlayerFunctions.getPlotSelectionIds(world, start, end));
|
||||
if(!PlotHelper.mergePlots(plr, world, PlayerFunctions.getPlotSelectionIds(world, start, end))) {
|
||||
return false;
|
||||
}
|
||||
br = true;
|
||||
}
|
||||
if ((z < q) && ((z - x) < q)) {
|
||||
|
@ -9,14 +9,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
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.PlotMain;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-01.
|
||||
@ -42,6 +38,15 @@ public class Delete extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
PlotWorld pWorld = PlotMain.getWorldSettings(plot.getWorld());
|
||||
if(PlotMain.useEconomy && pWorld.USE_ECONOMY) {
|
||||
double c = pWorld.SELL_PRICE;
|
||||
if(c > 0d) {
|
||||
Economy economy = PlotMain.economy;
|
||||
economy.depositPlayer(plr, c);
|
||||
sendMessage(plr, C.ADDED_BALANCE, c + "");
|
||||
}
|
||||
}
|
||||
boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true);
|
||||
if (result) {
|
||||
PlotHelper.removeSign(plr, plot);
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-03.
|
||||
@ -72,7 +72,7 @@ public class Denied extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -85,7 +85,8 @@ public class Denied extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.addDenied(uuid);
|
||||
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
||||
@ -110,7 +111,7 @@ public class Denied extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -127,7 +128,8 @@ public class Denied extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeDenied(uuid);
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Helpers extends SubCommand {
|
||||
@ -69,7 +69,7 @@ public class Helpers extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -82,7 +82,8 @@ public class Helpers extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.addHelper(uuid);
|
||||
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
||||
@ -100,7 +101,7 @@ public class Helpers extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -117,7 +118,8 @@ public class Helpers extends SubCommand {
|
||||
if (!plot.helpers.contains(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeHelper(uuid);
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
||||
|
@ -9,22 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -125,11 +120,13 @@ public class Info extends SubCommand {
|
||||
if (uuid.equals(DBFunc.everyone) || uuid.toString().equalsIgnoreCase(DBFunc.everyone.toString())) {
|
||||
return "everyone";
|
||||
}
|
||||
/*
|
||||
OfflinePlayer plr = Bukkit.getOfflinePlayer(uuid);
|
||||
if (plr.getName() == null) {
|
||||
return "unknown";
|
||||
}
|
||||
return plr.getName();
|
||||
return plr.getName();*/
|
||||
return UUIDHandler.getName(uuid);
|
||||
}
|
||||
|
||||
private Biome getBiomeAt(Plot plot) {
|
||||
|
@ -9,18 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* PlotMain command class
|
||||
@ -123,7 +122,7 @@ public class MainCommand implements CommandExecutor {
|
||||
if (cmd.permission.hasPermission(player) && (cmd.category == category)) {
|
||||
String s = t(C.HELP_PAGE.s());
|
||||
s = s.replaceAll("%alias%", cmd.alias);
|
||||
s = s.replaceAll("%usage%", "/plot " + cmd.usage);
|
||||
s = s.replaceAll("%usage%", cmd.usage.contains("plot") ? cmd.usage : "/plot " + cmd.usage);
|
||||
s = s.replaceAll("%cmd%", cmd.cmd);
|
||||
s = s.replaceAll("%desc%", cmd.description);
|
||||
help.add(s);
|
||||
|
@ -9,24 +9,15 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
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.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
import com.intellectualcrafters.plot.SetBlockFast;
|
||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -127,6 +118,7 @@ public class Merge extends SubCommand {
|
||||
PlotWorld plotWorld = PlotMain.getWorldSettings(world);
|
||||
if (PlotMain.useEconomy && plotWorld.USE_ECONOMY) {
|
||||
double cost = plotWorld.MERGE_PRICE;
|
||||
cost = plots.size() * cost;
|
||||
if (cost > 0d) {
|
||||
Economy economy = PlotMain.economy;
|
||||
if (economy.getBalance(plr) < cost) {
|
||||
|
@ -9,17 +9,11 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SetOwner extends SubCommand {
|
||||
@ -28,9 +22,14 @@ public class SetOwner extends SubCommand {
|
||||
super("setowner", "plots.admin", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS);
|
||||
}
|
||||
|
||||
/*
|
||||
private UUID getUUID(String string) {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(string);
|
||||
return ((player != null) && player.hasPlayedBefore()) ? player.getUniqueId() : null;
|
||||
}*/
|
||||
|
||||
private UUID getUUID(String string) {
|
||||
return UUIDHandler.getUUID(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Trusted extends SubCommand {
|
||||
@ -69,7 +69,7 @@ public class Trusted extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
|
||||
return true;
|
||||
}
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
/*if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
@ -82,7 +82,8 @@ public class Trusted extends SubCommand {
|
||||
if (uuid == null) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.addTrusted(uuid);
|
||||
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
||||
@ -100,6 +101,7 @@ public class Trusted extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
if (!hasBeenOnServer(args[1])) {
|
||||
PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
||||
return true;
|
||||
@ -117,7 +119,8 @@ public class Trusted extends SubCommand {
|
||||
if (!plot.trusted.contains(uuid)) {
|
||||
PlayerFunctions.sendMessage(plr, C.T_WAS_NOT_ADDED);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeTrusted(uuid);
|
||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||
PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
||||
|
@ -9,18 +9,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -97,11 +91,12 @@ public class list extends SubCommand {
|
||||
if (id == null) {
|
||||
return "none";
|
||||
}
|
||||
String name = Bukkit.getOfflinePlayer(id).getName();
|
||||
/*String name = Bukkit.getOfflinePlayer(id).getName();
|
||||
if (name == null) {
|
||||
return "none";
|
||||
}
|
||||
return name;
|
||||
return name;*/
|
||||
return UUIDHandler.getName(id);
|
||||
}
|
||||
|
||||
private String getArgumentList(String[] strings) {
|
||||
|
@ -9,13 +9,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.Settings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class plugin extends SubCommand {
|
||||
|
||||
@ -24,18 +28,50 @@ public class plugin extends SubCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player plr, String... args) {
|
||||
ArrayList<String> strings = new ArrayList<String>() {
|
||||
{
|
||||
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotMain.getMain().getDescription().getVersion()));
|
||||
add(String.format("&c>> &6Made by Citymonstret and brandonrelph"));
|
||||
add(String.format("&c>> &6Download at %s", Settings.URL));
|
||||
public boolean execute(final Player plr, String... args) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(PlotMain.class), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArrayList<String> strings = new ArrayList<String>() {
|
||||
{
|
||||
String
|
||||
downloads = getInfo("https://intellectualsites.com/spigot_api.php?method=downloads&url=http://www.spigotmc.org/resources/plotsquared.1177/"),
|
||||
version = getInfo("https://intellectualsites.com/spigot_api.php?method=version&resource=1177");
|
||||
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotMain.getMain().getDescription().getVersion()));
|
||||
add(String.format("&c>> &6Made by Citymonstret and Empire92"));
|
||||
add(String.format("&c>> &6Download at &lhttp://i-s.link/ps"));
|
||||
add(String.format("&c>> &cNewest Version (Spigot): %s", version));
|
||||
add(String.format("&c>> &cTotal Downloads (Spigot): %s", downloads));
|
||||
}
|
||||
};
|
||||
for (String s : strings) {
|
||||
PlayerFunctions.sendMessage(plr, s);
|
||||
}
|
||||
}
|
||||
};
|
||||
for (String s : strings) {
|
||||
PlayerFunctions.sendMessage(plr, s);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param link
|
||||
* @return
|
||||
*/
|
||||
private String getInfo(String link) {
|
||||
try {
|
||||
URLConnection connection = new URL(link).openConnection();
|
||||
connection.addRequestProperty("User-Agent", "Mozilla/4.0");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String document = "", line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
document += (line + "\n");
|
||||
}
|
||||
reader.close();
|
||||
return document;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,10 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.intellectualcrafters.plot.Configuration.*;
|
||||
import com.intellectualcrafters.plot.Configuration;
|
||||
import com.intellectualcrafters.plot.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.PlotBlock;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
|
||||
|
@ -4,7 +4,7 @@ version: 2.0.5
|
||||
load: STARTUP
|
||||
description: >
|
||||
Easy, yet powerful Plot World generation and management.
|
||||
authors: [Citymonstret, brandonrelph]
|
||||
authors: [Citymonstret, Empire92]
|
||||
softdepend: [WorldEdit, BarAPI, PlotMe, CameraAPI]
|
||||
database: false
|
||||
commands:
|
||||
|
Reference in New Issue
Block a user