Code Cleanup/Added Configurable option to deny and remove homes in ANY factions land.
More Soon..
This commit is contained in:
parent
3559a9f090
commit
5a37320397
@ -1,5 +1,5 @@
|
|||||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
<id>bin</id>
|
<id>bin</id>
|
||||||
<includeBaseDirectory>false</includeBaseDirectory>
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
@ -35,7 +35,7 @@ public class Conf {
|
|||||||
public static ChatColor colorWar = ChatColor.DARK_RED;
|
public static ChatColor colorWar = ChatColor.DARK_RED;
|
||||||
// Power
|
// Power
|
||||||
public static double powerPlayerMax = 10.0;
|
public static double powerPlayerMax = 10.0;
|
||||||
public static double powerPlayerMin = - 10.0;
|
public static double powerPlayerMin = -10.0;
|
||||||
public static double powerPlayerStarting = 0.0;
|
public static double powerPlayerStarting = 0.0;
|
||||||
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
|
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
|
||||||
public static double powerPerDeath = 4.0; // A death makes you lose 4 power
|
public static double powerPerDeath = 4.0; // A death makes you lose 4 power
|
||||||
|
@ -11,7 +11,7 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class FLocation implements Serializable {
|
public class FLocation implements Serializable {
|
||||||
private static final long serialVersionUID = - 8292915234027387983L;
|
private static final long serialVersionUID = -8292915234027387983L;
|
||||||
private static final boolean worldBorderSupport;
|
private static final boolean worldBorderSupport;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -60,7 +60,7 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
/**
|
/**
|
||||||
* Sets the faction of the FPlayer
|
* Sets the faction of the FPlayer
|
||||||
*
|
*
|
||||||
* @param faction faction to set.
|
* @param faction faction to set.
|
||||||
*/
|
*/
|
||||||
void setFaction(Faction faction);
|
void setFaction(Faction faction);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
String getFocused();
|
String getFocused();
|
||||||
|
|
||||||
void setFocused(String setFocused);
|
void setFocused(String setFocused);
|
||||||
|
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
void deinvite(FPlayer fplayer);
|
void deinvite(FPlayer fplayer);
|
||||||
|
|
||||||
void setUpgrade(Upgrade upgrade, int level);
|
void setUpgrade(Upgrade upgrade, int level);
|
||||||
|
|
||||||
int getUpgrade(Upgrade upgrade);
|
int getUpgrade(Upgrade upgrade);
|
||||||
|
|
||||||
boolean isInvited(FPlayer fplayer);
|
boolean isInvited(FPlayer fplayer);
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ public interface Faction extends EconomyParticipator {
|
|||||||
void resetPerms();
|
void resetPerms();
|
||||||
|
|
||||||
void disband(Player disbander);
|
void disband(Player disbander);
|
||||||
|
|
||||||
void disband(Player disbander, PlayerDisbandReason reason);
|
void disband(Player disbander, PlayerDisbandReason reason);
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
@ -273,9 +273,9 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
FPlayer getFPlayerAdmin();
|
FPlayer getFPlayerAdmin();
|
||||||
|
|
||||||
FPlayer getFPlayerLeader();
|
FPlayer getFPlayerLeader();
|
||||||
|
|
||||||
ArrayList<FPlayer> getFPlayersWhereRole(Role role);
|
ArrayList<FPlayer> getFPlayersWhereRole(Role role);
|
||||||
|
|
||||||
ArrayList<Player> getOnlinePlayers();
|
ArrayList<Player> getOnlinePlayers();
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ public interface Faction extends EconomyParticipator {
|
|||||||
// used when current leader is about to be removed from the faction;
|
// used when current leader is about to be removed from the faction;
|
||||||
// promotes new leader, or disbands faction if no other members left
|
// promotes new leader, or disbands faction if no other members left
|
||||||
void promoteNewLeader();
|
void promoteNewLeader();
|
||||||
|
|
||||||
void promoteNewLeader(boolean autoLeave);
|
void promoteNewLeader(boolean autoLeave);
|
||||||
|
|
||||||
Role getDefaultRole();
|
Role getDefaultRole();
|
||||||
|
@ -31,7 +31,7 @@ import java.net.URL;
|
|||||||
* @author Sam Jakob Harker, Brianna Hazel O'Keefe
|
* @author Sam Jakob Harker, Brianna Hazel O'Keefe
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings ("all")
|
@SuppressWarnings("all")
|
||||||
public class MassiveStats implements Listener {
|
public class MassiveStats implements Listener {
|
||||||
|
|
||||||
/* START: MASSIVESTATS SETTINGS */
|
/* START: MASSIVESTATS SETTINGS */
|
||||||
@ -258,7 +258,7 @@ class MassiveStatsUpdateTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings ("all")
|
@SuppressWarnings("all")
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
// Generate the request payload and serialize it as JSON.
|
// Generate the request payload and serialize it as JSON.
|
||||||
@ -431,7 +431,7 @@ class MassiveStatsDataRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings ("all")
|
@SuppressWarnings("all")
|
||||||
public String serialize() {
|
public String serialize() {
|
||||||
//return object.toString();
|
//return object.toString();
|
||||||
try {
|
try {
|
||||||
|
@ -2,12 +2,12 @@ package com.massivecraft.factions;
|
|||||||
|
|
||||||
import ch.njol.skript.Skript;
|
import ch.njol.skript.Skript;
|
||||||
import ch.njol.skript.SkriptAddon;
|
import ch.njol.skript.SkriptAddon;
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
||||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
import com.massivecraft.factions.cmd.FCmdRoot;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.integration.Essentials;
|
|
||||||
import com.massivecraft.factions.integration.Worldguard;
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
||||||
import com.massivecraft.factions.listeners.*;
|
import com.massivecraft.factions.listeners.*;
|
||||||
@ -56,7 +56,9 @@ public class SavageFactions extends MPlugin {
|
|||||||
// Single 4 life.
|
// Single 4 life.
|
||||||
public static SavageFactions plugin;
|
public static SavageFactions plugin;
|
||||||
public static Permission perms = null;
|
public static Permission perms = null;
|
||||||
|
// Persistence related
|
||||||
|
public static ArrayList<FPlayer> playersFlying = new ArrayList();
|
||||||
|
public Essentials ess;
|
||||||
public boolean PlaceholderApi;
|
public boolean PlaceholderApi;
|
||||||
// Commands
|
// Commands
|
||||||
public FCmdRoot cmdBase;
|
public FCmdRoot cmdBase;
|
||||||
@ -72,17 +74,14 @@ public class SavageFactions extends MPlugin {
|
|||||||
SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE,
|
SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE,
|
||||||
WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF,
|
WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF,
|
||||||
DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL;
|
DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL;
|
||||||
// Persistence related
|
SkriptAddon skriptAddon;
|
||||||
private boolean locked = false;
|
private boolean locked = false;
|
||||||
private Integer AutoLeaveTask = null;
|
private Integer AutoLeaveTask = null;
|
||||||
private boolean hookedPlayervaults;
|
private boolean hookedPlayervaults;
|
||||||
private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
|
private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
|
||||||
private boolean mvdwPlaceholderAPIManager = false;
|
private boolean mvdwPlaceholderAPIManager = false;
|
||||||
|
|
||||||
SkriptAddon skriptAddon;
|
|
||||||
|
|
||||||
private Listener[] eventsListener;
|
private Listener[] eventsListener;
|
||||||
|
|
||||||
public SavageFactions() {
|
public SavageFactions() {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
}
|
}
|
||||||
@ -157,11 +156,11 @@ public class SavageFactions extends MPlugin {
|
|||||||
|
|
||||||
// Load Conf from disk
|
// Load Conf from disk
|
||||||
Conf.load();
|
Conf.load();
|
||||||
Essentials.setup();
|
com.massivecraft.factions.integration.Essentials.setup();
|
||||||
hookedPlayervaults = setupPlayervaults();
|
hookedPlayervaults = setupPlayervaults();
|
||||||
FPlayers.getInstance().load();
|
FPlayers.getInstance().load();
|
||||||
Factions.getInstance().load();
|
Factions.getInstance().load();
|
||||||
|
|
||||||
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
|
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
|
||||||
Faction faction = Factions.getInstance().getFactionById(fPlayer.getFactionId());
|
Faction faction = Factions.getInstance().getFactionById(fPlayer.getFactionId());
|
||||||
if (faction == null) {
|
if (faction == null) {
|
||||||
@ -171,7 +170,12 @@ public class SavageFactions extends MPlugin {
|
|||||||
}
|
}
|
||||||
faction.addFPlayer(fPlayer);
|
faction.addFPlayer(fPlayer);
|
||||||
}
|
}
|
||||||
|
playersFlying.clear();
|
||||||
|
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
|
||||||
|
playersFlying.add(fPlayer);
|
||||||
|
}
|
||||||
|
UtilFly.run();
|
||||||
|
|
||||||
Board.getInstance().load();
|
Board.getInstance().load();
|
||||||
Board.getInstance().clean();
|
Board.getInstance().clean();
|
||||||
|
|
||||||
@ -206,38 +210,40 @@ public class SavageFactions extends MPlugin {
|
|||||||
factionsFlight = true;
|
factionsFlight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||||
log("Skript was found! Registering SavageFactions Addon...");
|
log("Skript was found! Registering SavageFactions Addon...");
|
||||||
skriptAddon = Skript.registerAddon(this);
|
skriptAddon = Skript.registerAddon(this);
|
||||||
try {
|
try {
|
||||||
skriptAddon.loadClasses("com.massivecraft.factions.skript", "expressions");
|
skriptAddon.loadClasses("com.massivecraft.factions.skript", "expressions");
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
log("Skript addon registered!");
|
log("Skript addon registered!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Register Event Handlers
|
// Register Event Handlers
|
||||||
eventsListener = new Listener[] {
|
eventsListener = new Listener[]{
|
||||||
new FactionsPlayerListener(),
|
new FactionsPlayerListener(),
|
||||||
new FactionsChatListener(),
|
new FactionsChatListener(),
|
||||||
new FactionsEntityListener(),
|
new FactionsEntityListener(),
|
||||||
new FactionsExploitListener(),
|
new FactionsExploitListener(),
|
||||||
new FactionsBlockListener(),
|
new FactionsBlockListener(),
|
||||||
new FUpgradesGUI(),
|
new FUpgradesGUI(),
|
||||||
new EXPUpgrade(),
|
new EXPUpgrade(),
|
||||||
new CropUpgrades(),
|
new CropUpgrades(),
|
||||||
new SpawnerUpgrades(),
|
new SpawnerUpgrades(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for (Listener eventListener: eventsListener)
|
for (Listener eventListener : eventsListener)
|
||||||
getServer().getPluginManager().registerEvents(eventListener, this);
|
getServer().getPluginManager().registerEvents(eventListener, this);
|
||||||
|
|
||||||
// since some other plugins execute commands directly through this command interface, provide it
|
// since some other plugins execute commands directly through this command interface, provide it
|
||||||
getCommand(this.refCommand).setExecutor(this);
|
getCommand(this.refCommand).setExecutor(this);
|
||||||
getCommand(this.refCommand).setTabCompleter(this);
|
getCommand(this.refCommand).setTabCompleter(this);
|
||||||
|
|
||||||
|
setupEssentials();
|
||||||
|
|
||||||
if (getDescription().getFullName().contains("BETA")) {
|
if (getDescription().getFullName().contains("BETA")) {
|
||||||
divider();
|
divider();
|
||||||
System.out.println("You are using a BETA version of the plugin!");
|
System.out.println("You are using a BETA version of the plugin!");
|
||||||
@ -251,9 +257,9 @@ public class SavageFactions extends MPlugin {
|
|||||||
this.loadSuccessful = true;
|
this.loadSuccessful = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkriptAddon getSkriptAddon() {
|
public SkriptAddon getSkriptAddon() {
|
||||||
return skriptAddon;
|
return skriptAddon;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupMultiversionMaterials() {
|
private void setupMultiversionMaterials() {
|
||||||
if (mc113) {
|
if (mc113) {
|
||||||
@ -330,35 +336,35 @@ public class SavageFactions extends MPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void migrateFPlayerLeaders() {
|
private void migrateFPlayerLeaders() {
|
||||||
List<String> lines = new ArrayList<>();
|
List<String> lines = new ArrayList<>();
|
||||||
File fplayerFile = new File("plugins\\Factions\\players.json");
|
File fplayerFile = new File("plugins\\Factions\\players.json");
|
||||||
|
|
||||||
try {
|
|
||||||
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
|
||||||
System.out.println("Migrating old players.json file.");
|
|
||||||
|
|
||||||
String line;
|
try {
|
||||||
while ((line = br.readLine()) != null) {
|
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
||||||
if (line.contains("\"role\": \"ADMIN\"")) {
|
System.out.println("Migrating old players.json file.");
|
||||||
line = line.replace("\"role\": \"ADMIN\"", "\"role\": " + "\"LEADER\"");
|
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
if (line.contains("\"role\": \"ADMIN\"")) {
|
||||||
|
line = line.replace("\"role\": \"ADMIN\"", "\"role\": " + "\"LEADER\"");
|
||||||
|
}
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
BufferedWriter bw = new BufferedWriter(new FileWriter(fplayerFile));
|
||||||
|
for (String newLine : lines) {
|
||||||
|
bw.write(newLine + "\n");
|
||||||
|
}
|
||||||
|
bw.flush();
|
||||||
|
bw.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
System.out.println("File was not found for players.json, assuming"
|
||||||
|
+ " there is no need to migrate old players.json file.");
|
||||||
}
|
}
|
||||||
lines.add(line);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(fplayerFile));
|
|
||||||
for (String newLine : lines) {
|
|
||||||
bw.write(newLine + "\n");
|
|
||||||
}
|
|
||||||
bw.flush();
|
|
||||||
bw.close();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
System.out.println("File was not found for players.json, assuming"
|
|
||||||
+ " there is no need to migrate old players.json file.");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void changeItemIDSInConfig() {
|
public void changeItemIDSInConfig() {
|
||||||
log("Starting conversion of legacy material in config to 1.13 materials.");
|
log("Starting conversion of legacy material in config to 1.13 materials.");
|
||||||
|
|
||||||
replaceStringInConfig("fperm-gui.relation.materials.recruit", "WOOD_SWORD", "WOODEN_SWORD");
|
replaceStringInConfig("fperm-gui.relation.materials.recruit", "WOOD_SWORD", "WOODEN_SWORD");
|
||||||
@ -380,7 +386,7 @@ public class SavageFactions extends MPlugin {
|
|||||||
replaceStringInConfig("fupgrades.MainMenu.DummyItem.Type", "STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE");
|
replaceStringInConfig("fupgrades.MainMenu.DummyItem.Type", "STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE");
|
||||||
replaceStringInConfig("fupgrades.MainMenu.EXP.EXPItem.Type", "EXP_BOTTLE", "EXPERIENCE_BOTTLE");
|
replaceStringInConfig("fupgrades.MainMenu.EXP.EXPItem.Type", "EXP_BOTTLE", "EXPERIENCE_BOTTLE");
|
||||||
replaceStringInConfig("fupgrades.MainMenu.Spawners.SpawnerItem.Type", "MOB_SPAWNER", "SPAWNER");
|
replaceStringInConfig("fupgrades.MainMenu.Spawners.SpawnerItem.Type", "MOB_SPAWNER", "SPAWNER");
|
||||||
|
|
||||||
replaceStringInConfig("fperm-gui.action.access.allow", "LIME", "LIME_STAINED_GLASS");
|
replaceStringInConfig("fperm-gui.action.access.allow", "LIME", "LIME_STAINED_GLASS");
|
||||||
replaceStringInConfig("fperm-gui.action.access.deny", "RED", "RED_STAINED_GLASS");
|
replaceStringInConfig("fperm-gui.action.access.deny", "RED", "RED_STAINED_GLASS");
|
||||||
replaceStringInConfig("fperm-gui.action.access.undefined", "CYAN", "CYAN_STAINED_GLASS");
|
replaceStringInConfig("fperm-gui.action.access.undefined", "CYAN", "CYAN_STAINED_GLASS");
|
||||||
@ -388,8 +394,8 @@ public class SavageFactions extends MPlugin {
|
|||||||
|
|
||||||
public void replaceStringInConfig(String path, String stringToReplace, String replacementString) {
|
public void replaceStringInConfig(String path, String stringToReplace, String replacementString) {
|
||||||
if (getConfig().getString(path).equals(stringToReplace)) {
|
if (getConfig().getString(path).equals(stringToReplace)) {
|
||||||
// SavageFactions.plugin.log("Replacing legacy material '" + stringToReplace + "' with '" + replacementString + "' for config node '" + path + "'.");
|
// SavageFactions.plugin.log("Replacing legacy material '" + stringToReplace + "' with '" + replacementString + "' for config node '" + path + "'.");
|
||||||
// log("Replacing legacy material '" + stringToReplace + "' with '" + replacementString + "' for config node '" + path + "'.");
|
// log("Replacing legacy material '" + stringToReplace + "' with '" + replacementString + "' for config node '" + path + "'.");
|
||||||
|
|
||||||
getConfig().set(path, replacementString);
|
getConfig().set(path, replacementString);
|
||||||
}
|
}
|
||||||
@ -447,10 +453,10 @@ public class SavageFactions extends MPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// only save data if plugin actually completely loaded successfully
|
// only save data if plugin actually completely loaded successfully
|
||||||
if (this.loadSuccessful) {
|
if (this.loadSuccessful) {
|
||||||
// Dont save, as this is kind of pointless, as the /f config command manually saves.
|
// Dont save, as this is kind of pointless, as the /f config command manually saves.
|
||||||
// So any edits done are saved, this way manual edits to json can go through.
|
// So any edits done are saved, this way manual edits to json can go through.
|
||||||
|
|
||||||
// Conf.save();
|
// Conf.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
@ -505,6 +511,11 @@ public class SavageFactions extends MPlugin {
|
|||||||
return econ;
|
return econ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean setupEssentials() {
|
||||||
|
SavageFactions.plugin.ess = (Essentials) this.getServer().getPluginManager().getPlugin("Essentials");
|
||||||
|
return SavageFactions.plugin.ess == null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean logPlayerCommands() {
|
public boolean logPlayerCommands() {
|
||||||
return Conf.logPlayerCommands;
|
return Conf.logPlayerCommands;
|
||||||
@ -525,58 +536,53 @@ public class SavageFactions extends MPlugin {
|
|||||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||||
return handleCommand(sender, cmd + " " + TextUtil.implode(Arrays.asList(split), " "), false);
|
return handleCommand(sender, cmd + " " + TextUtil.implode(Arrays.asList(split), " "), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer((Player) sender);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer((Player) sender);
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||||
List<String> argsList = new ArrayList<>(Arrays.asList(args));
|
List<String> argsList = new ArrayList<>(Arrays.asList(args));
|
||||||
argsList.remove(argsList.size() - 1);
|
argsList.remove(argsList.size() - 1);
|
||||||
String cmdValid = (cmd + " " + TextUtil.implode(argsList, " ")).trim();
|
String cmdValid = (cmd + " " + TextUtil.implode(argsList, " ")).trim();
|
||||||
MCommand<?> commandEx = cmdBase;
|
MCommand<?> commandEx = cmdBase;
|
||||||
List<MCommand<?>> commandsList = cmdBase.subCommands;
|
List<MCommand<?>> commandsList = cmdBase.subCommands;
|
||||||
|
|
||||||
if (Board.getInstance().getFactionAt(new FLocation(fPlayer.getPlayer().getLocation())) == Factions.getInstance().getWarZone()) {
|
if (Board.getInstance().getFactionAt(new FLocation(fPlayer.getPlayer().getLocation())) == Factions.getInstance().getWarZone()) {
|
||||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou cannot use autocomplete in warzone."));
|
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou cannot use autocomplete in warzone."));
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0))
|
for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0)) {
|
||||||
{
|
String cmdName = argsList.get(0).toLowerCase();
|
||||||
String cmdName = argsList.get(0).toLowerCase();
|
MCommand<?> commandFounded = commandsList.stream()
|
||||||
MCommand<?> commandFounded = commandsList.stream()
|
.filter(c -> c.aliases.contains(cmdName))
|
||||||
.filter(c -> c.aliases.contains(cmdName))
|
.findFirst().orElse(null);
|
||||||
.findFirst().orElse(null);
|
|
||||||
|
|
||||||
if (commandFounded != null)
|
if (commandFounded != null) {
|
||||||
{
|
commandEx = commandFounded;
|
||||||
commandEx = commandFounded;
|
commandsList = commandFounded.subCommands;
|
||||||
commandsList = commandFounded.subCommands;
|
} else break;
|
||||||
}
|
}
|
||||||
else break;
|
|
||||||
}
|
if (argsList.isEmpty()) {
|
||||||
|
for (MCommand<?> subCommand : commandEx.subCommands) {
|
||||||
if (argsList.isEmpty())
|
subCommand.setCommandSender(sender);
|
||||||
{
|
if (handleCommand(sender, cmdValid + " " + subCommand.aliases.get(0), true)
|
||||||
for (MCommand<?> subCommand: commandEx.subCommands)
|
&& subCommand.visibility != CommandVisibility.INVISIBLE
|
||||||
{
|
&& subCommand.validSenderType(sender, false)
|
||||||
subCommand.setCommandSender(sender);
|
&& subCommand.validSenderPermissions(sender, false))
|
||||||
if (handleCommand(sender, cmdValid + " " + subCommand.aliases.get(0), true)
|
completions.addAll(subCommand.aliases);
|
||||||
&& subCommand.visibility != CommandVisibility.INVISIBLE
|
}
|
||||||
&& subCommand.validSenderType(sender, false)
|
}
|
||||||
&& subCommand.validSenderPermissions(sender, false))
|
|
||||||
completions.addAll(subCommand.aliases);
|
String lastArg = args[args.length - 1].toLowerCase();
|
||||||
}
|
|
||||||
}
|
completions = completions.stream()
|
||||||
|
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
||||||
String lastArg = args[args.length - 1].toLowerCase();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
completions = completions.stream()
|
return completions;
|
||||||
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
return completions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createTimedHologram(final Location location, String text, Long timeout) {
|
public void createTimedHologram(final Location location, String text, Long timeout) {
|
||||||
@ -587,12 +593,12 @@ public class SavageFactions extends MPlugin {
|
|||||||
as.setCustomName(SavageFactions.plugin.color(text)); //Set this to the text you want
|
as.setCustomName(SavageFactions.plugin.color(text)); //Set this to the text you want
|
||||||
as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not
|
as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not
|
||||||
final ArmorStand armorStand = as;
|
final ArmorStand armorStand = as;
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> {
|
||||||
armorStand.remove();
|
armorStand.remove();
|
||||||
getLogger().info("Removing Hologram.");
|
getLogger().info("Removing Hologram.");
|
||||||
}
|
}
|
||||||
, timeout * 20);
|
, timeout * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class CmdAdmin extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
|
@ -23,7 +23,7 @@ public class CmdBanner extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = true;
|
senderMustBeColeader = true;
|
||||||
|
@ -41,12 +41,10 @@ public class CmdChat extends FCommand {
|
|||||||
modeString = modeString.toLowerCase();
|
modeString = modeString.toLowerCase();
|
||||||
// Only allow Mods and higher rank to switch to this channel.
|
// Only allow Mods and higher rank to switch to this channel.
|
||||||
if (modeString.startsWith("m")) {
|
if (modeString.startsWith("m")) {
|
||||||
if (!fme.getRole().isAtLeast(Role.MODERATOR))
|
if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||||
{
|
msg(TL.COMMAND_CHAT_MOD_ONLY);
|
||||||
msg(TL.COMMAND_CHAT_MOD_ONLY);
|
return;
|
||||||
return;
|
} else modeTarget = ChatMode.MOD;
|
||||||
}
|
|
||||||
else modeTarget = ChatMode.MOD;
|
|
||||||
} else if (modeString.startsWith("p")) {
|
} else if (modeString.startsWith("p")) {
|
||||||
modeTarget = ChatMode.PUBLIC;
|
modeTarget = ChatMode.PUBLIC;
|
||||||
} else if (modeString.startsWith("a")) {
|
} else if (modeString.startsWith("a")) {
|
||||||
@ -63,13 +61,22 @@ public class CmdChat extends FCommand {
|
|||||||
|
|
||||||
fme.setChatMode(modeTarget);
|
fme.setChatMode(modeTarget);
|
||||||
|
|
||||||
switch (fme.getChatMode())
|
switch (fme.getChatMode()) {
|
||||||
{
|
case MOD:
|
||||||
case MOD: msg(TL.COMMAND_CHAT_MODE_MOD); break;
|
msg(TL.COMMAND_CHAT_MODE_MOD);
|
||||||
case PUBLIC: msg(TL.COMMAND_CHAT_MODE_PUBLIC); break;
|
break;
|
||||||
case ALLIANCE: msg(TL.COMMAND_CHAT_MODE_ALLIANCE); break;
|
case PUBLIC:
|
||||||
case TRUCE: msg(TL.COMMAND_CHAT_MODE_TRUCE); break;
|
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
|
||||||
default: msg(TL.COMMAND_CHAT_MODE_FACTION); break;
|
break;
|
||||||
|
case ALLIANCE:
|
||||||
|
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
|
||||||
|
break;
|
||||||
|
case TRUCE:
|
||||||
|
msg(TL.COMMAND_CHAT_MODE_TRUCE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
msg(TL.COMMAND_CHAT_MODE_FACTION);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class CmdChest extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
|
@ -46,11 +46,10 @@ public class CmdClaim extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forFaction.isWilderness())
|
if (forFaction.isWilderness()) {
|
||||||
{
|
CmdUnclaim cmdUnclaim = SavageFactions.plugin.cmdBase.cmdUnclaim;
|
||||||
CmdUnclaim cmdUnclaim = SavageFactions.plugin.cmdBase.cmdUnclaim;
|
cmdUnclaim.execute(sender, args.size() > 1 ? args.subList(0, 1) : args);
|
||||||
cmdUnclaim.execute(sender, args.size() > 1 ? args.subList(0, 1):args);
|
return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radius < 1) {
|
if (radius < 1) {
|
||||||
|
@ -18,7 +18,7 @@ public class CmdClaimAt extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -26,7 +26,7 @@ public class CmdClaimLine extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -24,7 +24,7 @@ public class CmdColeader extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeAdmin = true;
|
senderMustBeAdmin = true;
|
||||||
|
@ -174,7 +174,7 @@ public class CmdConfig extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings ("unchecked") Set<Material> matSet = (Set<Material>) target.get(null);
|
@SuppressWarnings("unchecked") Set<Material> matSet = (Set<Material>) target.get(null);
|
||||||
|
|
||||||
// Material already present, so remove it
|
// Material already present, so remove it
|
||||||
if (matSet.contains(newMat)) {
|
if (matSet.contains(newMat)) {
|
||||||
@ -192,7 +192,7 @@ public class CmdConfig extends FCommand {
|
|||||||
|
|
||||||
// Set<String>
|
// Set<String>
|
||||||
else if (innerType == String.class) {
|
else if (innerType == String.class) {
|
||||||
@SuppressWarnings ("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
|
@SuppressWarnings("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
|
||||||
|
|
||||||
// String already present, so remove it
|
// String already present, so remove it
|
||||||
if (stringSet.contains(value.toString())) {
|
if (stringSet.contains(value.toString())) {
|
||||||
|
@ -13,7 +13,7 @@ public class CmdConvert extends FCommand {
|
|||||||
this.aliases.add("convert");
|
this.aliases.add("convert");
|
||||||
|
|
||||||
this.permission = Permission.CONVERT.node;
|
this.permission = Permission.CONVERT.node;
|
||||||
|
|
||||||
this.requiredArgs.add("[MYSQL|JSON]");
|
this.requiredArgs.add("[MYSQL|JSON]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class CmdCoords extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -25,7 +25,7 @@ public class CmdDeinvite extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = true;
|
senderMustBeModerator = true;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -4,6 +4,6 @@ public class CmdDemote extends FPromoteCommand {
|
|||||||
|
|
||||||
public CmdDemote() {
|
public CmdDemote() {
|
||||||
aliases.add("demote");
|
aliases.add("demote");
|
||||||
this.relative = - 1;
|
this.relative = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class CmdDescription extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = true;
|
senderMustBeColeader = true;
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FPlayers;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.SavageFactions;
|
|
||||||
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
import com.massivecraft.factions.util.UtilFly;
|
||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
@ -93,6 +91,7 @@ public class CmdDisband extends FCommand {
|
|||||||
if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) {
|
if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) {
|
||||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower);
|
String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower);
|
||||||
|
UtilFly.checkFly(this.fme, Board.getInstance().getFactionAt(new FLocation(follower)));
|
||||||
if (follower.getFaction() == faction) {
|
if (follower.getFaction() == faction) {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,7 +24,7 @@ public class CmdFWarp extends FCommand {
|
|||||||
this.optionalArgs.put("password", "password");
|
this.optionalArgs.put("password", "password");
|
||||||
|
|
||||||
|
|
||||||
this.permission = Permission.WARP.node;
|
this.permission = Permission.WARP.node;
|
||||||
this.senderMustBeMember = true;
|
this.senderMustBeMember = true;
|
||||||
this.senderMustBeModerator = false;
|
this.senderMustBeModerator = false;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
|
|
||||||
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
|
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
|
||||||
public static int id = - 1;
|
public static int id = -1;
|
||||||
public static int flyid = - 1;
|
public static int flyid = -1;
|
||||||
|
|
||||||
public CmdFly() {
|
public CmdFly() {
|
||||||
super();
|
super();
|
||||||
@ -33,7 +33,7 @@ public class CmdFly extends FCommand {
|
|||||||
this.optionalArgs.put("on/off", "flip");
|
this.optionalArgs.put("on/off", "flip");
|
||||||
|
|
||||||
|
|
||||||
this.permission = Permission.FLY.node;
|
this.permission = Permission.FLY.node;
|
||||||
this.senderMustBeMember = true;
|
this.senderMustBeMember = true;
|
||||||
this.senderMustBeModerator = false;
|
this.senderMustBeModerator = false;
|
||||||
}
|
}
|
||||||
@ -73,15 +73,15 @@ public class CmdFly extends FCommand {
|
|||||||
// 1.9+ based servers will use the built in particleAPI instead of packet based.
|
// 1.9+ based servers will use the built in particleAPI instead of packet based.
|
||||||
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
|
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
|
||||||
// So setting the amount to 0 spawns 1 in the precise location
|
// So setting the amount to 0 spawns 1 in the precise location
|
||||||
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, - 0.35, 0), 0);
|
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
|
||||||
} else {
|
} else {
|
||||||
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, - 0.35, 0), 16);
|
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (flyMap.keySet().size() == 0) {
|
if (flyMap.keySet().size() == 0) {
|
||||||
Bukkit.getScheduler().cancelTask(id);
|
Bukkit.getScheduler().cancelTask(id);
|
||||||
id = - 1;
|
id = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10L, 3L);
|
}, 10L, 3L);
|
||||||
@ -178,7 +178,7 @@ public class CmdFly extends FCommand {
|
|||||||
public static void checkTaskState() {
|
public static void checkTaskState() {
|
||||||
if (flyMap.keySet().size() == 0) {
|
if (flyMap.keySet().size() == 0) {
|
||||||
Bukkit.getScheduler().cancelTask(flyid);
|
Bukkit.getScheduler().cancelTask(flyid);
|
||||||
flyid = - 1;
|
flyid = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public class CmdFly extends FCommand {
|
|||||||
if (!checkBypassPerms(fme, me, toFac)) return;
|
if (!checkBypassPerms(fme, me, toFac)) return;
|
||||||
List<Entity> entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D);
|
List<Entity> entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D);
|
||||||
|
|
||||||
for (int i = 0; i <= entities.size() - 1; ++ i) {
|
for (int i = 0; i <= entities.size() - 1; ++i) {
|
||||||
if (entities.get(i) instanceof Player) {
|
if (entities.get(i) instanceof Player) {
|
||||||
Player eplayer = (Player) entities.get(i);
|
Player eplayer = (Player) entities.get(i);
|
||||||
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
||||||
@ -231,12 +231,12 @@ public class CmdFly extends FCommand {
|
|||||||
public void run() {
|
public void run() {
|
||||||
fme.setFlying(true);
|
fme.setFlying(true);
|
||||||
flyMap.put(player.getName(), true);
|
flyMap.put(player.getName(), true);
|
||||||
if (id == - 1) {
|
if (id == -1) {
|
||||||
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
|
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
|
||||||
startParticles();
|
startParticles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flyid == - 1) {
|
if (flyid == -1) {
|
||||||
startFlyCheck();
|
startFlyCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,18 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
public class CmdFocus
|
public class CmdFocus
|
||||||
extends FCommand {
|
extends FCommand {
|
||||||
public CmdFocus() {
|
public CmdFocus() {
|
||||||
aliases.add("focus");
|
aliases.add("focus");
|
||||||
|
|
||||||
requiredArgs.add("player");
|
requiredArgs.add("player");
|
||||||
|
|
||||||
permission = Permission.FOCUS.node;
|
permission = Permission.FOCUS.node;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = true;
|
senderMustBeModerator = true;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
@ -18,7 +18,7 @@ public class CmdGetVault extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -31,7 +31,7 @@ public class CmdHome extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -13,7 +13,7 @@ public class CmdInspect extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -24,7 +24,7 @@ public class CmdInvite extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -19,7 +19,7 @@ public class CmdJoin extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -27,7 +27,7 @@ public class CmdKick extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
|
@ -16,7 +16,7 @@ public class CmdLeave extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -53,7 +53,7 @@ public class CmdList extends FCommand {
|
|||||||
if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||||
List<String> exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt");
|
List<String> exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt");
|
||||||
Iterator<Faction> factionIterator = factionList.iterator();
|
Iterator<Faction> factionIterator = factionList.iterator();
|
||||||
|
|
||||||
while (factionIterator.hasNext()) {
|
while (factionIterator.hasNext()) {
|
||||||
Faction next = factionIterator.next();
|
Faction next = factionIterator.next();
|
||||||
if (exemptFactions.contains(next.getTag()))
|
if (exemptFactions.contains(next.getTag()))
|
||||||
@ -70,7 +70,7 @@ public class CmdList extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ public class CmdList extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class CmdLock extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -13,7 +13,7 @@ public class CmdLogins extends FCommand {
|
|||||||
this.aliases.add("logouts");
|
this.aliases.add("logouts");
|
||||||
this.senderMustBePlayer = true;
|
this.senderMustBePlayer = true;
|
||||||
|
|
||||||
this.senderMustBeMember = true;
|
this.senderMustBeMember = true;
|
||||||
this.permission = Permission.MONITOR_LOGINS.node;
|
this.permission = Permission.MONITOR_LOGINS.node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class CmdLowPower extends FCommand {
|
|||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
|
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = true;
|
senderMustBeColeader = true;
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
|
@ -20,7 +20,7 @@ public class CmdMap extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -16,7 +16,7 @@ public class CmdMapHeight extends FCommand {
|
|||||||
this.permission = Permission.MAPHEIGHT.node;
|
this.permission = Permission.MAPHEIGHT.node;
|
||||||
|
|
||||||
|
|
||||||
this.senderMustBePlayer = true;
|
this.senderMustBePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +25,7 @@ public class CmdMod extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = true;
|
senderMustBeColeader = true;
|
||||||
|
@ -19,7 +19,7 @@ public class CmdMoneyBalance extends FCommand {
|
|||||||
this.setHelpShort(TL.COMMAND_MONEYBALANCE_SHORT.toString());
|
this.setHelpShort(TL.COMMAND_MONEYBALANCE_SHORT.toString());
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
|
@ -22,7 +22,7 @@ public class CmdMoneyDeposit extends FCommand {
|
|||||||
this.permission = Permission.MONEY_DEPOSIT.node;
|
this.permission = Permission.MONEY_DEPOSIT.node;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -24,7 +24,7 @@ public class CmdMoneyTransferFf extends FCommand {
|
|||||||
this.permission = Permission.MONEY_F2F.node;
|
this.permission = Permission.MONEY_F2F.node;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -23,7 +23,7 @@ public class CmdMoneyTransferFp extends FCommand {
|
|||||||
this.permission = Permission.MONEY_F2P.node;
|
this.permission = Permission.MONEY_F2P.node;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -23,7 +23,7 @@ public class CmdMoneyTransferPf extends FCommand {
|
|||||||
this.permission = Permission.MONEY_P2F.node;
|
this.permission = Permission.MONEY_P2F.node;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -23,7 +23,7 @@ public class CmdMoneyWithdraw extends FCommand {
|
|||||||
this.permission = Permission.MONEY_WITHDRAW.node;
|
this.permission = Permission.MONEY_WITHDRAW.node;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -17,7 +17,7 @@ public class CmdNear extends FCommand {
|
|||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = true;
|
senderMustBeMember = true;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -19,7 +19,7 @@ public class CmdOpen extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = true;
|
senderMustBeColeader = true;
|
||||||
|
@ -20,7 +20,7 @@ public class CmdOwnerList extends FCommand {
|
|||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
@ -26,9 +26,9 @@ public class CmdReload extends FCommand {
|
|||||||
public void perform() {
|
public void perform() {
|
||||||
long timeInitStart = System.currentTimeMillis();
|
long timeInitStart = System.currentTimeMillis();
|
||||||
Conf.load();
|
Conf.load();
|
||||||
Conf.save();
|
Conf.save();
|
||||||
SavageFactions.plugin.reloadConfig();
|
SavageFactions.plugin.reloadConfig();
|
||||||
SavageFactions.plugin.changeItemIDSInConfig();
|
SavageFactions.plugin.changeItemIDSInConfig();
|
||||||
SavageFactions.plugin.loadLang();
|
SavageFactions.plugin.loadLang();
|
||||||
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
|
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
private boolean useParticles;
|
private boolean useParticles;
|
||||||
private int length;
|
private int length;
|
||||||
private ParticleEffect effect;
|
private ParticleEffect effect;
|
||||||
private int taskID = - 1;
|
private int taskID = -1;
|
||||||
|
|
||||||
|
|
||||||
//I remade it cause of people getting mad that I had the same seechunk as drtshock
|
//I remade it cause of people getting mad that I had the same seechunk as drtshock
|
||||||
@ -61,10 +61,10 @@ public class CmdSeeChunk extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void manageTask() {
|
private void manageTask() {
|
||||||
if (taskID != - 1) {
|
if (taskID != -1) {
|
||||||
if (seeChunkMap.keySet().size() == 0) {
|
if (seeChunkMap.keySet().size() == 0) {
|
||||||
Bukkit.getScheduler().cancelTask(taskID);
|
Bukkit.getScheduler().cancelTask(taskID);
|
||||||
taskID = - 1;
|
taskID = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startTask();
|
startTask();
|
||||||
|
@ -20,7 +20,7 @@ public class CmdSetDefaultRole extends FCommand {
|
|||||||
senderMustBeColeader = false;
|
senderMustBeColeader = false;
|
||||||
|
|
||||||
|
|
||||||
this.permission = Permission.DEFAULTRANK.node;
|
this.permission = Permission.DEFAULTRANK.node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ public class CmdSetFWarp extends FCommand {
|
|||||||
this.senderMustBeMember = true;
|
this.senderMustBeMember = true;
|
||||||
this.senderMustBeModerator = false;
|
this.senderMustBeModerator = false;
|
||||||
|
|
||||||
this.senderMustBePlayer = true;
|
this.senderMustBePlayer = true;
|
||||||
|
|
||||||
this.permission = Permission.SETWARP.node;
|
this.permission = Permission.SETWARP.node;
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ public class CmdSetFWarp extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String warp = argAsString(0);
|
String warp = argAsString(0);
|
||||||
|
|
||||||
// Checks if warp with same name already exists and ignores maxWarp check if it does.
|
// Checks if warp with same name already exists and ignores maxWarp check if it does.
|
||||||
|
@ -28,7 +28,7 @@ public class CmdSetMaxVaults extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
Faction targetFaction = argAsFaction(0);
|
Faction targetFaction = argAsFaction(0);
|
||||||
int value = argAsInt(1, - 1);
|
int value = argAsInt(1, -1);
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
|
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
|
||||||
return;
|
return;
|
||||||
|
@ -49,7 +49,7 @@ public class CmdShow extends FCommand {
|
|||||||
Faction faction = myFaction;
|
Faction faction = myFaction;
|
||||||
if (this.argIsSet(0))
|
if (this.argIsSet(0))
|
||||||
faction = this.argAsFaction(0);
|
faction = this.argAsFaction(0);
|
||||||
|
|
||||||
if (faction == null)
|
if (faction == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class CmdShow extends FCommand {
|
|||||||
List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed);
|
List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed);
|
||||||
if (fancy != null)
|
if (fancy != null)
|
||||||
sendFancyMessage(fancy);
|
sendFancyMessage(fancy);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
|
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
|
||||||
|
@ -21,7 +21,6 @@ public class CmdShowClaims extends FCommand {
|
|||||||
this.senderMustBePlayer = true;
|
this.senderMustBePlayer = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,7 +34,7 @@ public class CmdShowClaims extends FCommand {
|
|||||||
for (String world : chunkMap.keySet()) {
|
for (String world : chunkMap.keySet()) {
|
||||||
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
|
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
|
||||||
sendMessage(message.replace("{chunks}", "")); // made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
|
sendMessage(message.replace("{chunks}", "")); // made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
|
||||||
StringBuilder chunks = new StringBuilder();
|
StringBuilder chunks = new StringBuilder();
|
||||||
for (String chunkString : chunkMap.get(world)) {
|
for (String chunkString : chunkMap.get(world)) {
|
||||||
chunks.append(chunkString + ", ");
|
chunks.append(chunkString + ", ");
|
||||||
if (chunks.toString().length() >= 2000) {
|
if (chunks.toString().length() >= 2000) {
|
||||||
|
@ -30,7 +30,7 @@ public class CmdStatus extends FCommand {
|
|||||||
for (FPlayer fp : myFaction.getFPlayers()) {
|
for (FPlayer fp : myFaction.getFPlayers()) {
|
||||||
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
||||||
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
||||||
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET;
|
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET;
|
||||||
ret.add(String.format(TL.COMMAND_STATUS_FORMAT.toString(), ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, power, last).trim());
|
ret.add(String.format(TL.COMMAND_STATUS_FORMAT.toString(), ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, power, last).trim());
|
||||||
}
|
}
|
||||||
fme.sendMessage(ret);
|
fme.sendMessage(ret);
|
||||||
|
@ -99,7 +99,7 @@ public class CmdTnt extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fme.getFaction().getTnt() < amount) {
|
if (fme.getFaction().getTnt() < amount) {
|
||||||
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH);
|
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int fullStacks = amount / 64;
|
int fullStacks = amount / 64;
|
||||||
|
@ -55,7 +55,7 @@ public class CmdTntFill extends FCommand {
|
|||||||
fme.msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount") + ""));
|
fme.msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount") + ""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(args.get(1));
|
Integer.parseInt(args.get(1));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
@ -34,7 +34,7 @@ public class CmdTop extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
// Can sort by: money, members, online, allies, enemies, power, land.
|
// Can sort by: money, members, online, allies, enemies, power, land.
|
||||||
// Get all Factions and remove non player ones.
|
// Get all Factions and remove non player ones.
|
||||||
@ -55,7 +55,7 @@ public class CmdTop extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class CmdTop extends FCommand {
|
|||||||
if (f1start > f2start) {
|
if (f1start > f2start) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1start < f2start) {
|
} else if (f1start < f2start) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public class CmdTop extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ public class CmdTop extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public class CmdTop extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ public class CmdTop extends FCommand {
|
|||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class CmdUnban extends FCommand {
|
|||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeModerator = false;
|
senderMustBeModerator = false;
|
||||||
|
|
||||||
senderMustBeAdmin = false;
|
senderMustBeAdmin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,10 +45,9 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCommandSender(CommandSender sender)
|
public void setCommandSender(CommandSender sender) {
|
||||||
{
|
super.setCommandSender(sender);
|
||||||
super.setCommandSender(sender);
|
if (sender instanceof Player) {
|
||||||
if (sender instanceof Player) {
|
|
||||||
this.fme = FPlayers.getInstance().getByPlayer((Player) sender);
|
this.fme = FPlayers.getInstance().getByPlayer((Player) sender);
|
||||||
this.myFaction = this.fme.getFaction();
|
this.myFaction = this.fme.getFaction();
|
||||||
} else {
|
} else {
|
||||||
@ -56,7 +55,7 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
|||||||
this.myFaction = null;
|
this.myFaction = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
|
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
|
||||||
setCommandSender(sender);
|
setCommandSender(sender);
|
||||||
@ -312,9 +311,9 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
|
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
|
||||||
return Econ.modifyMoney(myFaction, - cost, toDoThis, forDoingThis);
|
return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis);
|
||||||
} else {
|
} else {
|
||||||
return Econ.modifyMoney(fme, - cost, toDoThis, forDoingThis);
|
return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class FPromoteCommand extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Role current = target.getRole();
|
Role current = target.getRole();
|
||||||
Role promotion = Role.getRelative(current, + relative);
|
Role promotion = Role.getRelative(current, +relative);
|
||||||
|
|
||||||
// Now it ain't that messy
|
// Now it ain't that messy
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!fme.isAdminBypassing()) {
|
||||||
|
@ -103,9 +103,9 @@ public abstract class FRelationCommand extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasMaxRelations(Faction them, Relation targetRelation) {
|
private boolean hasMaxRelations(Faction them, Relation targetRelation) {
|
||||||
int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), - 1);
|
int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), -1);
|
||||||
if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) {
|
if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) {
|
||||||
if (max != - 1) {
|
if (max != -1) {
|
||||||
if (myFaction.getRelationCount(targetRelation) >= max) {
|
if (myFaction.getRelationCount(targetRelation) >= max) {
|
||||||
msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation());
|
msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation());
|
||||||
return true;
|
return true;
|
||||||
|
@ -11,9 +11,9 @@ import org.bukkit.event.Cancellable;
|
|||||||
*/
|
*/
|
||||||
public class FactionDisbandEvent extends FactionEvent implements Cancellable {
|
public class FactionDisbandEvent extends FactionEvent implements Cancellable {
|
||||||
|
|
||||||
private boolean cancelled = false;
|
|
||||||
private final Player sender;
|
private final Player sender;
|
||||||
private final PlayerDisbandReason reason;
|
private final PlayerDisbandReason reason;
|
||||||
|
private boolean cancelled = false;
|
||||||
|
|
||||||
public FactionDisbandEvent(Player sender, String factionId, PlayerDisbandReason reason) {
|
public FactionDisbandEvent(Player sender, String factionId, PlayerDisbandReason reason) {
|
||||||
super(Factions.getInstance().getFactionById(factionId));
|
super(Factions.getInstance().getFactionById(factionId));
|
||||||
@ -30,10 +30,10 @@ public class FactionDisbandEvent extends FactionEvent implements Cancellable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlayerDisbandReason getReason() {
|
public PlayerDisbandReason getReason() {
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ public class FactionDisbandEvent extends FactionEvent implements Cancellable {
|
|||||||
public void setCancelled(boolean c) {
|
public void setCancelled(boolean c) {
|
||||||
cancelled = c;
|
cancelled = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PlayerDisbandReason {
|
public enum PlayerDisbandReason {
|
||||||
COMMAND,
|
COMMAND,
|
||||||
PLUGIN,
|
PLUGIN,
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package com.massivecraft.factions.event;
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event called when a player regenerate power.
|
* Event called when a player regenerate power.
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.massivecraft.factions.iface;
|
package com.massivecraft.factions.iface;
|
||||||
|
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public interface EconomyParticipator extends RelationParticipator {
|
public interface EconomyParticipator extends RelationParticipator {
|
||||||
|
|
||||||
public String getAccountId();
|
String getAccountId();
|
||||||
|
|
||||||
public void msg(String str, Object... args);
|
void msg(String str, Object... args);
|
||||||
|
|
||||||
public void msg(TL translation, Object... args);
|
void msg(TL translation, Object... args);
|
||||||
}
|
}
|
@ -1,17 +1,17 @@
|
|||||||
package com.massivecraft.factions.iface;
|
package com.massivecraft.factions.iface;
|
||||||
|
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public interface RelationParticipator {
|
public interface RelationParticipator {
|
||||||
|
|
||||||
public String describeTo(RelationParticipator that);
|
String describeTo(RelationParticipator that);
|
||||||
|
|
||||||
public String describeTo(RelationParticipator that, boolean ucfirst);
|
String describeTo(RelationParticipator that, boolean ucfirst);
|
||||||
|
|
||||||
public Relation getRelationTo(RelationParticipator that);
|
Relation getRelationTo(RelationParticipator that);
|
||||||
|
|
||||||
public Relation getRelationTo(RelationParticipator that, boolean ignorePeaceful);
|
Relation getRelationTo(RelationParticipator that, boolean ignorePeaceful);
|
||||||
|
|
||||||
public ChatColor getColorTo(RelationParticipator to);
|
ChatColor getColorTo(RelationParticipator to);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class Econ {
|
|||||||
// The amount must be positive.
|
// The amount must be positive.
|
||||||
// If the amount is negative we must flip and multiply amount with -1.
|
// If the amount is negative we must flip and multiply amount with -1.
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
amount *= - 1;
|
amount *= -1;
|
||||||
EconomyParticipator temp = from;
|
EconomyParticipator temp = from;
|
||||||
from = to;
|
from = to;
|
||||||
to = temp;
|
to = temp;
|
||||||
@ -308,7 +308,7 @@ public class Econ {
|
|||||||
// The account might not have enough space
|
// The account might not have enough space
|
||||||
EconomyResponse er = econ.depositPlayer(acc, delta);
|
EconomyResponse er = econ.depositPlayer(acc, delta);
|
||||||
if (er.transactionSuccess()) {
|
if (er.transactionSuccess()) {
|
||||||
modifyUniverseMoney(- delta);
|
modifyUniverseMoney(-delta);
|
||||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||||
ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis);
|
ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis);
|
||||||
}
|
}
|
||||||
@ -324,17 +324,17 @@ public class Econ {
|
|||||||
// The player should loose money
|
// The player should loose money
|
||||||
// The player might not have enough.
|
// The player might not have enough.
|
||||||
|
|
||||||
if (econ.has(acc, - delta) && econ.withdrawPlayer(acc, - delta).transactionSuccess()) {
|
if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
|
||||||
// There is enough money to pay
|
// There is enough money to pay
|
||||||
modifyUniverseMoney(- delta);
|
modifyUniverseMoney(-delta);
|
||||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||||
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(- delta), forDoingThis);
|
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(-delta), forDoingThis);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// There was not enough money to pay
|
// There was not enough money to pay
|
||||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
if (toDoThis != null && !toDoThis.isEmpty()) {
|
||||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(- delta), toDoThis);
|
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(-delta), toDoThis);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ public class Econ {
|
|||||||
|
|
||||||
public static boolean modifyBalance(String account, double amount) {
|
public static boolean modifyBalance(String account, double amount) {
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
return econ.withdrawPlayer(account, - amount).transactionSuccess();
|
return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
||||||
} else {
|
} else {
|
||||||
return econ.depositPlayer(account, amount).transactionSuccess();
|
return econ.depositPlayer(account, amount).transactionSuccess();
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,7 @@ package com.massivecraft.factions.integration;
|
|||||||
import com.earth2me.essentials.Teleport;
|
import com.earth2me.essentials.Teleport;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
|
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -15,6 +11,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class Essentials {
|
public class Essentials {
|
||||||
|
|
||||||
private static IEssentials essentials;
|
private static IEssentials essentials;
|
||||||
|
@ -1,139 +1,139 @@
|
|||||||
package com.massivecraft.factions.integration;
|
package com.massivecraft.factions.integration;
|
||||||
|
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.SavageFactions;
|
import com.massivecraft.factions.SavageFactions;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
|
import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Worldguard Region Checking
|
* Worldguard Region Checking
|
||||||
* Author: Spathizilla
|
* Author: Spathizilla
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Worldguard {
|
public class Worldguard {
|
||||||
|
|
||||||
private static WorldGuardPlugin wg;
|
private static WorldGuardPlugin wg;
|
||||||
private static boolean enabled = false;
|
private static boolean enabled = false;
|
||||||
|
|
||||||
public static void init(Plugin plugin) {
|
public static void init(Plugin plugin) {
|
||||||
Plugin wgplug = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
|
Plugin wgplug = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||||
if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) {
|
if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
wg = null;
|
wg = null;
|
||||||
SavageFactions.plugin.log("Could not hook to WorldGuard. WorldGuard checks are disabled.");
|
SavageFactions.plugin.log("Could not hook to WorldGuard. WorldGuard checks are disabled.");
|
||||||
} else {
|
} else {
|
||||||
wg = (WorldGuardPlugin) wgplug;
|
wg = (WorldGuardPlugin) wgplug;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
SavageFactions.plugin.log("Successfully hooked to WorldGuard.");
|
SavageFactions.plugin.log("Successfully hooked to WorldGuard.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PVP Flag check
|
// PVP Flag check
|
||||||
// Returns:
|
// Returns:
|
||||||
// True: PVP is allowed
|
// True: PVP is allowed
|
||||||
// False: PVP is disallowed
|
// False: PVP is disallowed
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static boolean isPVP(Player player) {
|
public static boolean isPVP(Player player) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
// No WG hooks so we'll always bypass this check.
|
// No WG hooks so we'll always bypass this check.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
World world = loc.getWorld();
|
World world = loc.getWorld();
|
||||||
Vector pt = toVector(loc);
|
Vector pt = toVector(loc);
|
||||||
|
|
||||||
RegionManager regionManager = wg.getRegionManager(world);
|
RegionManager regionManager = wg.getRegionManager(world);
|
||||||
ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
|
ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
|
||||||
return set.allows(DefaultFlag.PVP);
|
return set.allows(DefaultFlag.PVP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if player can build at location by worldguards rules.
|
// Check if player can build at location by worldguards rules.
|
||||||
// Returns:
|
// Returns:
|
||||||
// True: Player can build in the region.
|
// True: Player can build in the region.
|
||||||
// False: Player can not build in the region.
|
// False: Player can not build in the region.
|
||||||
public static boolean playerCanBuild(Player player, Location loc) {
|
public static boolean playerCanBuild(Player player, Location loc) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
// No WG hooks so we'll always bypass this check.
|
// No WG hooks so we'll always bypass this check.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
World world = loc.getWorld();
|
World world = loc.getWorld();
|
||||||
Vector pt = toVector(loc);
|
Vector pt = toVector(loc);
|
||||||
|
|
||||||
return wg.getRegionManager(world).getApplicableRegions(pt).size() > 0 && wg.canBuild(player, loc);
|
return wg.getRegionManager(world).getApplicableRegions(pt).size() > 0 && wg.canBuild(player, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for Regions in chunk the chunk
|
// Check for Regions in chunk the chunk
|
||||||
// Returns:
|
// Returns:
|
||||||
// True: Regions found within chunk
|
// True: Regions found within chunk
|
||||||
// False: No regions found within chunk
|
// False: No regions found within chunk
|
||||||
|
|
||||||
public static boolean checkForRegionsInChunk(FLocation floc) {
|
public static boolean checkForRegionsInChunk(FLocation floc) {
|
||||||
Chunk chunk = floc.getWorld().getChunkAt((int) floc.getX(), (int) floc.getZ());
|
Chunk chunk = floc.getWorld().getChunkAt((int) floc.getX(), (int) floc.getZ());
|
||||||
|
|
||||||
return checkForRegionsInChunk(chunk);
|
return checkForRegionsInChunk(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkForRegionsInChunk(Location loc) {
|
public static boolean checkForRegionsInChunk(Location loc) {
|
||||||
Chunk chunk = loc.getWorld().getChunkAt(loc);
|
Chunk chunk = loc.getWorld().getChunkAt(loc);
|
||||||
|
|
||||||
return checkForRegionsInChunk(chunk);
|
return checkForRegionsInChunk(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkForRegionsInChunk(Chunk chunk) {
|
public static boolean checkForRegionsInChunk(Chunk chunk) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
// No WG hooks so we'll always bypass this check.
|
// No WG hooks so we'll always bypass this check.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
World world = chunk.getWorld();
|
World world = chunk.getWorld();
|
||||||
int minChunkX = chunk.getX() << 4;
|
int minChunkX = chunk.getX() << 4;
|
||||||
int minChunkZ = chunk.getZ() << 4;
|
int minChunkZ = chunk.getZ() << 4;
|
||||||
int maxChunkX = minChunkX + 15;
|
int maxChunkX = minChunkX + 15;
|
||||||
int maxChunkZ = minChunkZ + 15;
|
int maxChunkZ = minChunkZ + 15;
|
||||||
|
|
||||||
int worldHeight = world.getMaxHeight(); // Allow for heights other than default
|
int worldHeight = world.getMaxHeight(); // Allow for heights other than default
|
||||||
|
|
||||||
BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ);
|
BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ);
|
||||||
BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ);
|
BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ);
|
||||||
|
|
||||||
RegionManager regionManager = wg.getRegionManager(world);
|
RegionManager regionManager = wg.getRegionManager(world);
|
||||||
ProtectedCuboidRegion region = new ProtectedCuboidRegion("wgfactionoverlapcheck", minChunk, maxChunk);
|
ProtectedCuboidRegion region = new ProtectedCuboidRegion("wgfactionoverlapcheck", minChunk, maxChunk);
|
||||||
Map<String, ProtectedRegion> allregions = regionManager.getRegions();
|
Map<String, ProtectedRegion> allregions = regionManager.getRegions();
|
||||||
Collection<ProtectedRegion> allregionslist = new ArrayList<>(allregions.values());
|
Collection<ProtectedRegion> allregionslist = new ArrayList<>(allregions.values());
|
||||||
List<ProtectedRegion> overlaps;
|
List<ProtectedRegion> overlaps;
|
||||||
boolean foundregions = false;
|
boolean foundregions = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
overlaps = region.getIntersectingRegions(allregionslist);
|
overlaps = region.getIntersectingRegions(allregionslist);
|
||||||
foundregions = overlaps != null && !overlaps.isEmpty();
|
foundregions = overlaps != null && !overlaps.isEmpty();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundregions;
|
return foundregions;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -45,7 +45,8 @@ public class EngineDynmap {
|
|||||||
public MarkerAPI markerApi;
|
public MarkerAPI markerApi;
|
||||||
public MarkerSet markerset;
|
public MarkerSet markerset;
|
||||||
|
|
||||||
private EngineDynmap() {}
|
private EngineDynmap() {
|
||||||
|
}
|
||||||
|
|
||||||
public static EngineDynmap getInstance() {
|
public static EngineDynmap getInstance() {
|
||||||
return i;
|
return i;
|
||||||
@ -63,7 +64,7 @@ public class EngineDynmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getHtmlPlayerName(FPlayer fplayer) {
|
public static String getHtmlPlayerName(FPlayer fplayer) {
|
||||||
return fplayer != null ? escapeHtml(fplayer.getName()):"none";
|
return fplayer != null ? escapeHtml(fplayer.getName()) : "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String escapeHtml(String string) {
|
public static String escapeHtml(String string) {
|
||||||
@ -72,8 +73,8 @@ public class EngineDynmap {
|
|||||||
char c = string.charAt(i);
|
char c = string.charAt(i);
|
||||||
if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&') {
|
if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&') {
|
||||||
out.append("&#")
|
out.append("&#")
|
||||||
.append((int) c)
|
.append((int) c)
|
||||||
.append(';');
|
.append(';');
|
||||||
} else {
|
} else {
|
||||||
out.append(c);
|
out.append(c);
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ public class TempAreaMarker {
|
|||||||
|
|
||||||
public String label;
|
public String label;
|
||||||
public String world;
|
public String world;
|
||||||
public double x[];
|
public double[] x;
|
||||||
public double z[];
|
public double[] z;
|
||||||
public String description;
|
public String description;
|
||||||
|
|
||||||
public int lineColor;
|
public int lineColor;
|
||||||
@ -27,7 +27,7 @@ public class TempAreaMarker {
|
|||||||
// CREATE
|
// CREATE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static boolean equals(AreaMarker marker, double x[], double z[]) {
|
public static boolean equals(AreaMarker marker, double[] x, double[] z) {
|
||||||
int length = marker.getCornerCount();
|
int length = marker.getCornerCount();
|
||||||
|
|
||||||
if (x.length != length) {
|
if (x.length != length) {
|
||||||
|
@ -9,7 +9,6 @@ import com.massivecraft.factions.util.Particles.ParticleEffect;
|
|||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -39,7 +38,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) {
|
public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) {
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
|
|
||||||
if (Conf.playersWhoBypassAllProtection.contains(name))
|
if (Conf.playersWhoBypassAllProtection.contains(name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
|
if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -138,19 +137,19 @@ public class FactionsBlockListener implements Listener {
|
|||||||
if (access != Access.ALLOW && me.getRole() != Role.LEADER) {
|
if (access != Access.ALLOW && me.getRole() != Role.LEADER) {
|
||||||
// TODO: Update this once new access values are added other than just allow / deny.
|
// TODO: Update this once new access values are added other than just allow / deny.
|
||||||
if (access == Access.DENY) {
|
if (access == Access.DENY) {
|
||||||
if (!justCheck)
|
if (!justCheck)
|
||||||
me.msg(TL.GENERIC_NOPERMISSION, action);
|
me.msg(TL.GENERIC_NOPERMISSION, action);
|
||||||
return false;
|
return false;
|
||||||
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) {
|
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) {
|
||||||
if (!justCheck)
|
if (!justCheck)
|
||||||
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
|
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
if (!event.canBuild()) {
|
if (!event.canBuild()) {
|
||||||
return;
|
return;
|
||||||
@ -166,7 +165,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
if (!Conf.handleExploitLiquidFlow) {
|
if (!Conf.handleExploitLiquidFlow) {
|
||||||
return;
|
return;
|
||||||
@ -190,14 +189,14 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockDamage(BlockDamageEvent event) {
|
public void onBlockDamage(BlockDamageEvent event) {
|
||||||
if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||||
if (!Conf.pistonProtectionThroughDenyBuild) {
|
if (!Conf.pistonProtectionThroughDenyBuild) {
|
||||||
return;
|
return;
|
||||||
@ -219,7 +218,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
* only the final target block as done above
|
* only the final target block as done above
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onVaultPlace(BlockPlaceEvent e) {
|
public void onVaultPlace(BlockPlaceEvent e) {
|
||||||
if (e.getItemInHand().getType() == Material.CHEST) {
|
if (e.getItemInHand().getType() == Material.CHEST) {
|
||||||
@ -304,7 +303,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
// if not a sticky piston, retraction should be fine
|
// if not a sticky piston, retraction should be fine
|
||||||
if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) {
|
if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) {
|
||||||
@ -372,7 +371,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
// if (fplayer == fme) { continue; } //Idk if I wanna not send the title to the player
|
// if (fplayer == fme) { continue; } //Idk if I wanna not send the title to the player
|
||||||
fplayer.getPlayer().sendTitle(SavageFactions.plugin.color(fme.getTag() + " Placed A WarBanner!"), SavageFactions.plugin.color("&7use &c/f tpbanner&7 to tp to the banner!"), 10, 70, 20);
|
fplayer.getPlayer().sendTitle(SavageFactions.plugin.color(fme.getTag() + " Placed A WarBanner!"), SavageFactions.plugin.color("&7use &c/f tpbanner&7 to tp to the banner!"), 10, 70, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
bannerCooldownMap.put(fme.getTag(), true);
|
bannerCooldownMap.put(fme.getTag(), true);
|
||||||
bannerLocations.put(fme.getTag(), e.getBlockPlaced().getLocation());
|
bannerLocations.put(fme.getTag(), e.getBlockPlaced().getLocation());
|
||||||
final int bannerCooldown = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Place-Cooldown");
|
final int bannerCooldown = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Place-Cooldown");
|
||||||
@ -439,7 +438,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onFrostWalker(EntityBlockFormEvent event) {
|
public void onFrostWalker(EntityBlockFormEvent event) {
|
||||||
if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) {
|
if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) {
|
||||||
return;
|
return;
|
||||||
@ -485,7 +484,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
return !rel.confDenyBuild(otherFaction.hasPlayersOnline());
|
return !rel.confDenyBuild(otherFaction.hasPlayersOnline());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -505,22 +504,19 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFarmLandDamage(EntityChangeBlockEvent event)
|
public void onFarmLandDamage(EntityChangeBlockEvent event) {
|
||||||
{
|
if (event.getEntity() instanceof Player) {
|
||||||
if (event.getEntity() instanceof Player)
|
Player player = (Player) event.getEntity();
|
||||||
{
|
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true)) {
|
||||||
Player player = (Player) event.getEntity();
|
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
|
||||||
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true))
|
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation()));
|
||||||
{
|
Faction myFaction = me.getFaction();
|
||||||
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
|
|
||||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation()));
|
me.msg("<b>You can't jump on farmland in the territory of " + otherFaction.getTag(myFaction));
|
||||||
Faction myFaction = me.getFaction();
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
me.msg("<b>You can't jump on farmland in the territory of " + otherFaction.getTag(myFaction));
|
}
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import java.util.logging.Level;
|
|||||||
public class FactionsChatListener implements Listener {
|
public class FactionsChatListener implements Listener {
|
||||||
|
|
||||||
// this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first
|
// this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first
|
||||||
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerEarlyChat(AsyncPlayerChatEvent event) {
|
public void onPlayerEarlyChat(AsyncPlayerChatEvent event) {
|
||||||
Player talkingPlayer = event.getPlayer();
|
Player talkingPlayer = event.getPlayer();
|
||||||
String msg = event.getMessage();
|
String msg = event.getMessage();
|
||||||
@ -127,7 +127,7 @@ public class FactionsChatListener implements Listener {
|
|||||||
|
|
||||||
|
|
||||||
// this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first
|
// this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first
|
||||||
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
// Are we to insert the Faction tag into the format?
|
// Are we to insert the Faction tag into the format?
|
||||||
// If we are not to insert it - we are done.
|
// If we are not to insert it - we are done.
|
||||||
|
@ -33,7 +33,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
private static final Set<PotionEffectType> badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER));
|
private static final Set<PotionEffectType> badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER));
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (!(entity instanceof Player)) {
|
if (!(entity instanceof Player)) {
|
||||||
@ -86,7 +86,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
* Who can I hurt? I can never hurt members or allies. I can always hurt enemies. I can hurt neutrals as long as
|
* Who can I hurt? I can never hurt members or allies. I can always hurt enemies. I can hurt neutrals as long as
|
||||||
* they are outside their own territory.
|
* they are outside their own territory.
|
||||||
*/
|
*/
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if (event instanceof EntityDamageByEntityEvent) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
|
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
|
||||||
@ -233,7 +233,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
Entity boomer = event.getEntity();
|
Entity boomer = event.getEntity();
|
||||||
|
|
||||||
@ -270,12 +270,12 @@ public class FactionsEntityListener implements Listener {
|
|||||||
// a single surrounding block in all 6 directions is broken if the material is weak enough
|
// a single surrounding block in all 6 directions is broken if the material is weak enough
|
||||||
List<Block> targets = new ArrayList<>();
|
List<Block> targets = new ArrayList<>();
|
||||||
targets.add(center.getRelative(0, 0, 1));
|
targets.add(center.getRelative(0, 0, 1));
|
||||||
targets.add(center.getRelative(0, 0, - 1));
|
targets.add(center.getRelative(0, 0, -1));
|
||||||
targets.add(center.getRelative(0, 1, 0));
|
targets.add(center.getRelative(0, 1, 0));
|
||||||
targets.add(center.getRelative(0, - 1, 0));
|
targets.add(center.getRelative(0, -1, 0));
|
||||||
targets.add(center.getRelative(1, 0, 0));
|
targets.add(center.getRelative(1, 0, 0));
|
||||||
targets.add(center.getRelative(- 1, 0, 0));
|
targets.add(center.getRelative(-1, 0, 0));
|
||||||
|
|
||||||
for (Block target : targets) {
|
for (Block target : targets) {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
int id = target.getType().getId();
|
int id = target.getType().getId();
|
||||||
@ -322,7 +322,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
|
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0d);
|
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0d);
|
||||||
if (!this.canDamagerHurtDamagee(sub, false)) {
|
if (!this.canDamagerHurtDamagee(sub, false)) {
|
||||||
@ -330,7 +330,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPotionSplashEvent(PotionSplashEvent event) {
|
public void onPotionSplashEvent(PotionSplashEvent event) {
|
||||||
// see if the potion has a harmful effect
|
// see if the potion has a harmful effect
|
||||||
boolean badjuju = false;
|
boolean badjuju = false;
|
||||||
@ -544,7 +544,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
if (event.getLocation() == null) {
|
if (event.getLocation() == null) {
|
||||||
return;
|
return;
|
||||||
@ -555,7 +555,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
// if there is a target
|
// if there is a target
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
@ -574,7 +574,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPaintingBreak(HangingBreakEvent event) {
|
public void onPaintingBreak(HangingBreakEvent event) {
|
||||||
if (event.getCause() == RemoveCause.EXPLOSION) {
|
if (event.getCause() == RemoveCause.EXPLOSION) {
|
||||||
Location loc = event.getEntity().getLocation();
|
Location loc = event.getEntity().getLocation();
|
||||||
@ -610,7 +610,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPaintingPlace(HangingPlaceEvent event) {
|
public void onPaintingPlace(HangingPlaceEvent event) {
|
||||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) {
|
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -619,7 +619,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For disabling interactions with item frames in another faction's territory
|
// For disabling interactions with item frames in another faction's territory
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
// only need to check for item frames
|
// only need to check for item frames
|
||||||
if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) {
|
if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) {
|
||||||
@ -731,7 +731,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For disabling interactions with armor stands in another faction's territory
|
// For disabling interactions with armor stands in another faction's territory
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
|
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
|
||||||
Entity entity = event.getRightClicked();
|
Entity entity = event.getRightClicked();
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class FactionsExploitListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void obsidianGenerator(BlockFromToEvent event) {
|
public void obsidianGenerator(BlockFromToEvent event) {
|
||||||
if (!Conf.handleExploitObsidianGenerators) {
|
if (!Conf.handleExploitObsidianGenerators) {
|
||||||
return;
|
return;
|
||||||
@ -34,7 +34,7 @@ public class FactionsExploitListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void enderPearlTeleport(PlayerTeleportEvent event) {
|
public void enderPearlTeleport(PlayerTeleportEvent event) {
|
||||||
if (!Conf.handleExploitEnderPearlClipping) {
|
if (!Conf.handleExploitEnderPearlClipping) {
|
||||||
return;
|
return;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -18,80 +18,80 @@ import org.bukkit.event.Event;
|
|||||||
public class PlayerFactionExpression extends SimpleExpression<String> {
|
public class PlayerFactionExpression extends SimpleExpression<String> {
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Skript.registerExpression(PlayerFactionExpression.class, String.class, ExpressionType.SIMPLE, "[the] faction of %player%", "[the] %player%['s] faction");
|
Skript.registerExpression(PlayerFactionExpression.class, String.class, ExpressionType.SIMPLE, "[the] faction of %player%", "[the] %player%['s] faction");
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression<Player> playerExpression;
|
Expression<Player> playerExpression;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends String> getReturnType() {
|
public Class<? extends String> getReturnType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSingle() {
|
public boolean isSingle() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
||||||
playerExpression = (Expression<Player>) exprs[0];
|
playerExpression = (Expression<Player>) exprs[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Event event, boolean debug) {
|
public String toString(Event event, boolean debug) {
|
||||||
return "Player Faction Name Expression with expression player" + playerExpression.toString(event, debug);
|
return "Player Faction Name Expression with expression player" + playerExpression.toString(event, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] get(Event event) {
|
protected String[] get(Event event) {
|
||||||
Player player = playerExpression.getSingle(event);
|
Player player = playerExpression.getSingle(event);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
return new String[]{fPlayer.getFaction().getTag()};
|
return new String[]{fPlayer.getFaction().getTag()};
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
|
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
|
||||||
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.RESET || mode == Changer.ChangeMode.SET) {
|
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.RESET || mode == Changer.ChangeMode.SET) {
|
||||||
return CollectionUtils.array(String.class);
|
return CollectionUtils.array(String.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
|
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
|
||||||
Player player = playerExpression.getSingle(event);
|
Player player = playerExpression.getSingle(event);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DELETE:
|
case DELETE:
|
||||||
case RESET:
|
case RESET:
|
||||||
fPlayer.setFaction(Factions.getInstance().getWilderness());
|
fPlayer.setFaction(Factions.getInstance().getWilderness());
|
||||||
break;
|
break;
|
||||||
case SET:
|
case SET:
|
||||||
Faction faction = Factions.getInstance().getByTag((String) delta[0]);
|
Faction faction = Factions.getInstance().getByTag((String) delta[0]);
|
||||||
if (faction == null) {
|
if (faction == null) {
|
||||||
faction = Factions.getInstance().getWilderness();
|
faction = Factions.getInstance().getWilderness();
|
||||||
}
|
}
|
||||||
fPlayer.setFaction(faction);
|
fPlayer.setFaction(faction);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,80 +16,80 @@ import org.bukkit.event.Event;
|
|||||||
public class PlayerPowerExpression extends SimpleExpression<Number> {
|
public class PlayerPowerExpression extends SimpleExpression<Number> {
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Skript.registerExpression(PlayerPowerExpression.class, Number.class, ExpressionType.SIMPLE, "[the] power of %player%", "[the] %player%['s] power");
|
Skript.registerExpression(PlayerPowerExpression.class, Number.class, ExpressionType.SIMPLE, "[the] power of %player%", "[the] %player%['s] power");
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression<Player> playerExpression;
|
Expression<Player> playerExpression;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends Number> getReturnType() {
|
public Class<? extends Number> getReturnType() {
|
||||||
return Double.class;
|
return Double.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSingle() {
|
public boolean isSingle() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
||||||
playerExpression = (Expression<Player>) exprs[0];
|
playerExpression = (Expression<Player>) exprs[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Event event, boolean debug) {
|
public String toString(Event event, boolean debug) {
|
||||||
return "Player Power with expression player" + playerExpression.toString(event, debug);
|
return "Player Power with expression player" + playerExpression.toString(event, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Double[] get(Event event) {
|
protected Double[] get(Event event) {
|
||||||
Player player = playerExpression.getSingle(event);
|
Player player = playerExpression.getSingle(event);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
return new Double[]{fPlayer.getFaction().getPower()};
|
return new Double[]{fPlayer.getFaction().getPower()};
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
|
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
|
||||||
if (mode == Changer.ChangeMode.RESET || mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.REMOVE) {
|
if (mode == Changer.ChangeMode.RESET || mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.REMOVE) {
|
||||||
return CollectionUtils.array(Number.class);
|
return CollectionUtils.array(Number.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
|
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
|
||||||
Player player = playerExpression.getSingle(event);
|
Player player = playerExpression.getSingle(event);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ADD:
|
case ADD:
|
||||||
fPlayer.alterPower(Double.valueOf((Long) delta[0]));
|
fPlayer.alterPower(Double.valueOf((Long) delta[0]));
|
||||||
break;
|
break;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
fPlayer.alterPower(Double.valueOf((Long) delta[0]) * -1);
|
fPlayer.alterPower(Double.valueOf((Long) delta[0]) * -1);
|
||||||
break;
|
break;
|
||||||
case RESET:
|
case RESET:
|
||||||
fPlayer.alterPower(fPlayer.getPowerMax() * -1);
|
fPlayer.alterPower(fPlayer.getPowerMax() * -1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,77 +16,77 @@ import org.bukkit.event.Event;
|
|||||||
|
|
||||||
public class PlayerRoleExpression extends SimpleExpression<String> {
|
public class PlayerRoleExpression extends SimpleExpression<String> {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Skript.registerExpression(PlayerRoleExpression.class, String.class, ExpressionType.SIMPLE, "[the] role of %player%", "[the] %player%['s] role");
|
Skript.registerExpression(PlayerRoleExpression.class, String.class, ExpressionType.SIMPLE, "[the] role of %player%", "[the] %player%['s] role");
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression<Player> playerExpression;
|
Expression<Player> playerExpression;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends String> getReturnType() {
|
public Class<? extends String> getReturnType() {
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSingle() {
|
public boolean isSingle() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parser) {
|
||||||
playerExpression = (Expression<Player>) exprs[0];
|
playerExpression = (Expression<Player>) exprs[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Event event, boolean debug) {
|
public String toString(Event event, boolean debug) {
|
||||||
return "Player Faction Name Expression with expression player" + playerExpression.toString(event, debug);
|
return "Player Faction Name Expression with expression player" + playerExpression.toString(event, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] get(Event event) {
|
protected String[] get(Event event) {
|
||||||
Player player = playerExpression.getSingle(event);
|
Player player = playerExpression.getSingle(event);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
return new String[]{fPlayer.getRole().toString()};
|
return new String[]{fPlayer.getRole().toString()};
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
|
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
|
||||||
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.RESET || mode == Changer.ChangeMode.SET) {
|
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.RESET || mode == Changer.ChangeMode.SET) {
|
||||||
return CollectionUtils.array(String.class);
|
return CollectionUtils.array(String.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
|
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
|
||||||
Player player = playerExpression.getSingle(event);
|
Player player = playerExpression.getSingle(event);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DELETE:
|
case DELETE:
|
||||||
case RESET:
|
case RESET:
|
||||||
fPlayer.setRole(Role.RECRUIT);
|
fPlayer.setRole(Role.RECRUIT);
|
||||||
break;
|
break;
|
||||||
case SET:
|
case SET:
|
||||||
fPlayer.setRole(Role.fromString(((String) delta[0]).toLowerCase()));
|
fPlayer.setRole(Role.fromString(((String) delta[0]).toLowerCase()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,15 +95,19 @@ public enum Relation implements Permissable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getColor() {
|
public ChatColor getColor() {
|
||||||
|
|
||||||
switch (this)
|
switch (this) {
|
||||||
{
|
case MEMBER:
|
||||||
case MEMBER: return Conf.colorMember;
|
return Conf.colorMember;
|
||||||
case ALLY: return Conf.colorAlly;
|
case ALLY:
|
||||||
case NEUTRAL: return Conf.colorNeutral;
|
return Conf.colorAlly;
|
||||||
case TRUCE: return Conf.colorTruce;
|
case NEUTRAL:
|
||||||
default: return Conf.colorEnemy;
|
return Conf.colorNeutral;
|
||||||
}
|
case TRUCE:
|
||||||
|
return Conf.colorTruce;
|
||||||
|
default:
|
||||||
|
return Conf.colorEnemy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return appropriate Conf setting for DenyBuild based on this relation and their online status
|
// return appropriate Conf setting for DenyBuild based on this relation and their online status
|
||||||
|
@ -92,15 +92,19 @@ public enum Role implements Permissable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
|
|
||||||
switch (this)
|
switch (this) {
|
||||||
{
|
case LEADER:
|
||||||
case LEADER: return Conf.prefixLeader;
|
return Conf.prefixLeader;
|
||||||
case COLEADER: return Conf.prefixCoLeader;
|
case COLEADER:
|
||||||
case MODERATOR: return Conf.prefixMod;
|
return Conf.prefixCoLeader;
|
||||||
case NORMAL: return Conf.prefixNormal;
|
case MODERATOR:
|
||||||
case RECRUIT: return Conf.prefixRecruit;
|
return Conf.prefixMod;
|
||||||
}
|
case NORMAL:
|
||||||
|
return Conf.prefixNormal;
|
||||||
|
case RECRUIT:
|
||||||
|
return Conf.prefixRecruit;
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
case "faction_claims":
|
case "faction_claims":
|
||||||
return String.valueOf(faction.getAllClaims().size());
|
return String.valueOf(faction.getAllClaims().size());
|
||||||
case "faction_founded":
|
case "faction_founded":
|
||||||
return String.valueOf(TL.sdf.format(faction.getFoundedDate()));
|
return TL.sdf.format(faction.getFoundedDate());
|
||||||
case "faction_joining":
|
case "faction_joining":
|
||||||
return (faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString());
|
return (faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString());
|
||||||
case "faction_peaceful":
|
case "faction_peaceful":
|
||||||
@ -156,8 +156,8 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
case "faction_maxvaults":
|
case "faction_maxvaults":
|
||||||
return String.valueOf(faction.getMaxVaults());
|
return String.valueOf(faction.getMaxVaults());
|
||||||
case "faction_name_at_location":
|
case "faction_name_at_location":
|
||||||
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
|
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
|
||||||
return factionAtLocation != null ? factionAtLocation.getTag():Factions.getInstance().getWilderness().getTag();
|
return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,66 +1,66 @@
|
|||||||
package com.massivecraft.factions.util;
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.TypeAdapter;
|
import com.google.gson.TypeAdapter;
|
||||||
import com.google.gson.TypeAdapterFactory;
|
import com.google.gson.TypeAdapterFactory;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.google.gson.stream.JsonToken;
|
import com.google.gson.stream.JsonToken;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
||||||
|
|
||||||
public static final TypeAdapterFactory ENUM_FACTORY = newEnumTypeHierarchyFactory();
|
public static final TypeAdapterFactory ENUM_FACTORY = newEnumTypeHierarchyFactory();
|
||||||
private final Map<String, T> nameToConstant = new HashMap<>();
|
private final Map<String, T> nameToConstant = new HashMap<>();
|
||||||
private final Map<T, String> constantToName = new HashMap<>();
|
private final Map<T, String> constantToName = new HashMap<>();
|
||||||
|
|
||||||
public EnumTypeAdapter(Class<T> classOfT) {
|
public EnumTypeAdapter(Class<T> classOfT) {
|
||||||
try {
|
try {
|
||||||
for (T constant : classOfT.getEnumConstants()) {
|
for (T constant : classOfT.getEnumConstants()) {
|
||||||
String name = constant.name();
|
String name = constant.name();
|
||||||
SerializedName annotation = classOfT.getField(name).getAnnotation(SerializedName.class);
|
SerializedName annotation = classOfT.getField(name).getAnnotation(SerializedName.class);
|
||||||
if (annotation != null) {
|
if (annotation != null) {
|
||||||
name = annotation.value();
|
name = annotation.value();
|
||||||
}
|
}
|
||||||
nameToConstant.put(name, constant);
|
nameToConstant.put(name, constant);
|
||||||
constantToName.put(constant, name);
|
constantToName.put(constant, name);
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
// ignore since it could be a modified enum
|
// ignore since it could be a modified enum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() {
|
public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() {
|
||||||
return new TypeAdapterFactory() {
|
return new TypeAdapterFactory() {
|
||||||
@SuppressWarnings ({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||||
Class<? super T> rawType = typeToken.getRawType();
|
Class<? super T> rawType = typeToken.getRawType();
|
||||||
if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {
|
if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!rawType.isEnum()) {
|
if (!rawType.isEnum()) {
|
||||||
rawType = rawType.getSuperclass(); // handle anonymous subclasses
|
rawType = rawType.getSuperclass(); // handle anonymous subclasses
|
||||||
}
|
}
|
||||||
return (TypeAdapter<T>) new EnumTypeAdapter(rawType);
|
return (TypeAdapter<T>) new EnumTypeAdapter(rawType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public T read(JsonReader in) throws IOException {
|
public T read(JsonReader in) throws IOException {
|
||||||
if (in.peek() == JsonToken.NULL) {
|
if (in.peek() == JsonToken.NULL) {
|
||||||
in.nextNull();
|
in.nextNull();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return nameToConstant.get(in.nextString());
|
return nameToConstant.get(in.nextString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(JsonWriter out, T value) throws IOException {
|
public void write(JsonWriter out, T value) throws IOException {
|
||||||
out.value(value == null ? null : constantToName.get(value));
|
out.value(value == null ? null : constantToName.get(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import org.bukkit.event.inventory.ClickType;
|
|||||||
|
|
||||||
public interface FactionGUI {
|
public interface FactionGUI {
|
||||||
|
|
||||||
public void onClick(int slot, ClickType action);
|
void onClick(int slot, ClickType action);
|
||||||
|
|
||||||
public void build();
|
void build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class LazyLocation implements Serializable {
|
public class LazyLocation implements Serializable {
|
||||||
private static final long serialVersionUID = - 6049901271320963314L;
|
private static final long serialVersionUID = -6049901271320963314L;
|
||||||
private transient Location location = null;
|
private transient Location location = null;
|
||||||
private String worldName;
|
private String worldName;
|
||||||
private double x;
|
private double x;
|
||||||
|
@ -100,11 +100,21 @@ public class MiscUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (player.getRole()) {
|
switch (player.getRole()) {
|
||||||
case LEADER: admins.add(player); break;
|
case LEADER:
|
||||||
case COLEADER: admins.add(player); break;
|
admins.add(player);
|
||||||
case MODERATOR: moderators.add(player); break;
|
break;
|
||||||
case NORMAL: normal.add(player); break;
|
case COLEADER:
|
||||||
case RECRUIT: recruit.add(player); break;
|
admins.add(player);
|
||||||
|
break;
|
||||||
|
case MODERATOR:
|
||||||
|
moderators.add(player);
|
||||||
|
break;
|
||||||
|
case NORMAL:
|
||||||
|
normal.add(player);
|
||||||
|
break;
|
||||||
|
case RECRUIT:
|
||||||
|
recruit.add(player);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,8 +858,8 @@ public enum MultiversionMaterials {
|
|||||||
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
||||||
ZOMBIE_WALL_HEAD("SKULL", 0),
|
ZOMBIE_WALL_HEAD("SKULL", 0),
|
||||||
;
|
;
|
||||||
|
|
||||||
static int newV = - 1;
|
static int newV = -1;
|
||||||
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
|
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
|
||||||
String m;
|
String m;
|
||||||
int data;
|
int data;
|
||||||
@ -872,13 +872,13 @@ public enum MultiversionMaterials {
|
|||||||
public static boolean isNewVersion() {
|
public static boolean isNewVersion() {
|
||||||
if (newV == 0) return false;
|
if (newV == 0) return false;
|
||||||
if (newV == 1) return true;
|
if (newV == 1) return true;
|
||||||
|
|
||||||
Material mat = Material.matchMaterial("RED_WOOL");
|
Material mat = Material.matchMaterial("RED_WOOL");
|
||||||
if (mat != null) {
|
if (mat != null) {
|
||||||
newV = 1;
|
newV = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
newV = 0;
|
newV = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -898,11 +898,11 @@ public enum MultiversionMaterials {
|
|||||||
|
|
||||||
public static MultiversionMaterials fromString(String key) {
|
public static MultiversionMaterials fromString(String key) {
|
||||||
try {
|
try {
|
||||||
return MultiversionMaterials.valueOf(key);
|
return MultiversionMaterials.valueOf(key);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
String[] split = key.split(":");
|
String[] split = key.split(":");
|
||||||
|
|
||||||
return split.length == 1 ? requestXMaterial(key, (byte) 0):requestXMaterial(split[0], (byte) Integer.parseInt(split[1]));
|
return split.length == 1 ? requestXMaterial(key, (byte) 0) : requestXMaterial(split[0], (byte) Integer.parseInt(split[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,7 +944,7 @@ public enum MultiversionMaterials {
|
|||||||
|
|
||||||
public boolean isDamageable(MultiversionMaterials type) {
|
public boolean isDamageable(MultiversionMaterials type) {
|
||||||
String[] split = type.toString().split("_");
|
String[] split = type.toString().split("_");
|
||||||
|
|
||||||
switch (split[split.length - 1]) {
|
switch (split[split.length - 1]) {
|
||||||
case "HELMET":
|
case "HELMET":
|
||||||
case "CHESTPLATE":
|
case "CHESTPLATE":
|
||||||
@ -968,7 +968,7 @@ public enum MultiversionMaterials {
|
|||||||
|
|
||||||
public Material parseMaterial() {
|
public Material parseMaterial() {
|
||||||
Material mat = Material.matchMaterial(this.toString());
|
Material mat = Material.matchMaterial(this.toString());
|
||||||
return mat != null ? mat:Material.matchMaterial(m);
|
return mat != null ? mat : Material.matchMaterial(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -20,7 +20,7 @@ import java.util.Map.Entry;
|
|||||||
/**
|
/**
|
||||||
* <b>ParticleEffect Library</b>
|
* <b>ParticleEffect Library</b>
|
||||||
* This library was created by @DarkBlade12 and allows you to display all Minecraft particle effects on a Bukkit server
|
* This library was created by @DarkBlade12 and allows you to display all Minecraft particle effects on a Bukkit server
|
||||||
*
|
* <p>
|
||||||
* You are welcome to use it, modify it and redistribute it under the following conditions:
|
* You are welcome to use it, modify it and redistribute it under the following conditions:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Don't claim this class as your own
|
* <li>Don't claim this class as your own
|
||||||
@ -47,7 +47,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
EXPLOSION_NORMAL("explode", 0, - 1, ParticleProperty.DIRECTIONAL),
|
EXPLOSION_NORMAL("explode", 0, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by exploding ghast fireballs and wither skulls:
|
* A particle effect which is displayed by exploding ghast fireballs and wither skulls:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -55,7 +55,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value slightly influences the size of this particle effect
|
* <li>The speed value slightly influences the size of this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
EXPLOSION_LARGE("largeexplode", 1, - 1),
|
EXPLOSION_LARGE("largeexplode", 1, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by exploding tnt and creepers:
|
* A particle effect which is displayed by exploding tnt and creepers:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -63,7 +63,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
EXPLOSION_HUGE("hugeexplosion", 2, - 1),
|
EXPLOSION_HUGE("hugeexplosion", 2, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by launching fireworks:
|
* A particle effect which is displayed by launching fireworks:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -71,7 +71,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
FIREWORKS_SPARK("fireworksSpark", 3, - 1, ParticleProperty.DIRECTIONAL),
|
FIREWORKS_SPARK("fireworksSpark", 3, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by swimming entities and arrows in water:
|
* A particle effect which is displayed by swimming entities and arrows in water:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -79,7 +79,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
WATER_BUBBLE("bubble", 4, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
|
WATER_BUBBLE("bubble", 4, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by swimming entities and shaking wolves:
|
* A particle effect which is displayed by swimming entities and shaking wolves:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -87,7 +87,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
WATER_SPLASH("splash", 5, - 1, ParticleProperty.DIRECTIONAL),
|
WATER_SPLASH("splash", 5, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed on water when fishing:
|
* A particle effect which is displayed on water when fishing:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -103,7 +103,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SUSPENDED("suspended", 7, - 1, ParticleProperty.REQUIRES_WATER),
|
SUSPENDED("suspended", 7, -1, ParticleProperty.REQUIRES_WATER),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by air when close to bedrock and the in the void:
|
* A particle effect which is displayed by air when close to bedrock and the in the void:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -111,7 +111,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SUSPENDED_DEPTH("depthSuspend", 8, - 1, ParticleProperty.DIRECTIONAL),
|
SUSPENDED_DEPTH("depthSuspend", 8, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when landing a critical hit and by arrows:
|
* A particle effect which is displayed when landing a critical hit and by arrows:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -119,7 +119,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
CRIT("crit", 9, - 1, ParticleProperty.DIRECTIONAL),
|
CRIT("crit", 9, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when landing a hit with an enchanted weapon:
|
* A particle effect which is displayed when landing a hit with an enchanted weapon:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -127,7 +127,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
CRIT_MAGIC("magicCrit", 10, - 1, ParticleProperty.DIRECTIONAL),
|
CRIT_MAGIC("magicCrit", 10, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners:
|
* A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -135,7 +135,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SMOKE_NORMAL("smoke", 11, - 1, ParticleProperty.DIRECTIONAL),
|
SMOKE_NORMAL("smoke", 11, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by fire, minecarts with furnace and blazes:
|
* A particle effect which is displayed by fire, minecarts with furnace and blazes:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -143,7 +143,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SMOKE_LARGE("largesmoke", 12, - 1, ParticleProperty.DIRECTIONAL),
|
SMOKE_LARGE("largesmoke", 12, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when splash potions or bottles o' enchanting hit something:
|
* A particle effect which is displayed when splash potions or bottles o' enchanting hit something:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -152,7 +152,7 @@ public enum ParticleEffect {
|
|||||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SPELL("spell", 13, - 1),
|
SPELL("spell", 13, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when instant splash potions hit something:
|
* A particle effect which is displayed when instant splash potions hit something:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -161,7 +161,7 @@ public enum ParticleEffect {
|
|||||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SPELL_INSTANT("instantSpell", 14, - 1),
|
SPELL_INSTANT("instantSpell", 14, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by entities with active potion effects:
|
* A particle effect which is displayed by entities with active potion effects:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -170,7 +170,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SPELL_MOB("mobSpell", 15, - 1, ParticleProperty.COLORABLE),
|
SPELL_MOB("mobSpell", 15, -1, ParticleProperty.COLORABLE),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by entities with active potion effects applied through a beacon:
|
* A particle effect which is displayed by entities with active potion effects applied through a beacon:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -179,7 +179,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, - 1, ParticleProperty.COLORABLE),
|
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, -1, ParticleProperty.COLORABLE),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by witches:
|
* A particle effect which is displayed by witches:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -188,7 +188,7 @@ public enum ParticleEffect {
|
|||||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SPELL_WITCH("witchMagic", 17, - 1),
|
SPELL_WITCH("witchMagic", 17, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by blocks beneath a water source:
|
* A particle effect which is displayed by blocks beneath a water source:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -196,7 +196,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
DRIP_WATER("dripWater", 18, - 1),
|
DRIP_WATER("dripWater", 18, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by blocks beneath a lava source:
|
* A particle effect which is displayed by blocks beneath a lava source:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -204,7 +204,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
DRIP_LAVA("dripLava", 19, - 1),
|
DRIP_LAVA("dripLava", 19, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when attacking a villager in a village:
|
* A particle effect which is displayed when attacking a villager in a village:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -212,7 +212,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
VILLAGER_ANGRY("angryVillager", 20, - 1),
|
VILLAGER_ANGRY("angryVillager", 20, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when using bone meal and trading with a villager in a village:
|
* A particle effect which is displayed when using bone meal and trading with a villager in a village:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -220,7 +220,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
VILLAGER_HAPPY("happyVillager", 21, - 1, ParticleProperty.DIRECTIONAL),
|
VILLAGER_HAPPY("happyVillager", 21, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by mycelium:
|
* A particle effect which is displayed by mycelium:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -228,7 +228,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
TOWN_AURA("townaura", 22, - 1, ParticleProperty.DIRECTIONAL),
|
TOWN_AURA("townaura", 22, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by note blocks:
|
* A particle effect which is displayed by note blocks:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -236,7 +236,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value causes the particle to be colored green when set to 0
|
* <li>The speed value causes the particle to be colored green when set to 0
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
NOTE("note", 23, - 1, ParticleProperty.COLORABLE),
|
NOTE("note", 23, -1, ParticleProperty.COLORABLE),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs:
|
* A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -244,7 +244,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the spread of this particle effect
|
* <li>The speed value influences the spread of this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
PORTAL("portal", 24, - 1, ParticleProperty.DIRECTIONAL),
|
PORTAL("portal", 24, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by enchantment tables which are nearby bookshelves:
|
* A particle effect which is displayed by enchantment tables which are nearby bookshelves:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -252,7 +252,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the spread of this particle effect
|
* <li>The speed value influences the spread of this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
ENCHANTMENT_TABLE("enchantmenttable", 25, - 1, ParticleProperty.DIRECTIONAL),
|
ENCHANTMENT_TABLE("enchantmenttable", 25, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners:
|
* A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -260,7 +260,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
FLAME("flame", 26, - 1, ParticleProperty.DIRECTIONAL),
|
FLAME("flame", 26, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by lava:
|
* A particle effect which is displayed by lava:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -268,7 +268,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
LAVA("lava", 27, - 1),
|
LAVA("lava", 27, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is currently unused:
|
* A particle effect which is currently unused:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -276,7 +276,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
FOOTSTEP("footstep", 28, - 1),
|
FOOTSTEP("footstep", 28, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when a mob dies:
|
* A particle effect which is displayed when a mob dies:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -284,7 +284,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
CLOUD("cloud", 29, - 1, ParticleProperty.DIRECTIONAL),
|
CLOUD("cloud", 29, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters:
|
* A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -292,7 +292,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value causes the particle to be colored red when set to 0
|
* <li>The speed value causes the particle to be colored red when set to 0
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
REDSTONE("reddust", 30, - 1, ParticleProperty.COLORABLE),
|
REDSTONE("reddust", 30, -1, ParticleProperty.COLORABLE),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when snowballs hit a block:
|
* A particle effect which is displayed when snowballs hit a block:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -300,7 +300,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SNOWBALL("snowballpoof", 31, - 1),
|
SNOWBALL("snowballpoof", 31, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is currently unused:
|
* A particle effect which is currently unused:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -308,7 +308,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value influences the velocity at which the particle flies off
|
* <li>The speed value influences the velocity at which the particle flies off
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SNOW_SHOVEL("snowshovel", 32, - 1, ParticleProperty.DIRECTIONAL),
|
SNOW_SHOVEL("snowshovel", 32, -1, ParticleProperty.DIRECTIONAL),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by slimes:
|
* A particle effect which is displayed by slimes:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -316,7 +316,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
SLIME("slime", 33, - 1),
|
SLIME("slime", 33, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when breeding and taming animals:
|
* A particle effect which is displayed when breeding and taming animals:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -324,7 +324,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
HEART("heart", 34, - 1),
|
HEART("heart", 34, -1),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed by barriers:
|
* A particle effect which is displayed by barriers:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -339,7 +339,7 @@ public enum ParticleEffect {
|
|||||||
* <li>It looks like a little piece with an item texture
|
* <li>It looks like a little piece with an item texture
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
ITEM_CRACK("iconcrack", 36, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
|
ITEM_CRACK("iconcrack", 36, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when breaking blocks or sprinting:
|
* A particle effect which is displayed when breaking blocks or sprinting:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -347,7 +347,7 @@ public enum ParticleEffect {
|
|||||||
* <li>The speed value has no influence on this particle effect
|
* <li>The speed value has no influence on this particle effect
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
BLOCK_CRACK("blockcrack", 37, - 1, ParticleProperty.REQUIRES_DATA),
|
BLOCK_CRACK("blockcrack", 37, -1, ParticleProperty.REQUIRES_DATA),
|
||||||
/**
|
/**
|
||||||
* A particle effect which is displayed when falling:
|
* A particle effect which is displayed when falling:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -524,7 +524,6 @@ public enum ParticleEffect {
|
|||||||
/**
|
/**
|
||||||
* Determine if this particle effect has a specific property
|
* Determine if this particle effect has a specific property
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param property - property to check.
|
* @param property - property to check.
|
||||||
* @return Whether it has the property or not
|
* @return Whether it has the property or not
|
||||||
*/
|
*/
|
||||||
@ -538,7 +537,7 @@ public enum ParticleEffect {
|
|||||||
* @return Whether the particle effect is supported or not
|
* @return Whether the particle effect is supported or not
|
||||||
*/
|
*/
|
||||||
public boolean isSupported() {
|
public boolean isSupported() {
|
||||||
if (requiredVersion == - 1) {
|
if (requiredVersion == -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ParticlePacket.getVersion() >= requiredVersion;
|
return ParticlePacket.getVersion() >= requiredVersion;
|
||||||
@ -946,7 +945,7 @@ public enum ParticleEffect {
|
|||||||
* @param material Material of the item/block
|
* @param material Material of the item/block
|
||||||
* @param data Data value of the item/block
|
* @param data Data value of the item/block
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings ("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public ParticleData(Material material, byte data) {
|
public ParticleData(Material material, byte data) {
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@ -1177,7 +1176,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the color for the {@link ParticleEffect#NOTE} effect
|
* Represents the color for the {@link ParticleEffect#NOTE} effect
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1236,7 +1235,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that is thrown either if the displayed particle effect requires data and has none or vice-versa or if the data type is incorrect
|
* Represents a runtime exception that is thrown either if the displayed particle effect requires data and has none or vice-versa or if the data type is incorrect
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1257,7 +1256,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that is thrown either if the displayed particle effect is not colorable or if the particle color type is incorrect
|
* Represents a runtime exception that is thrown either if the displayed particle effect is not colorable or if the particle color type is incorrect
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1278,7 +1277,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that is thrown if the displayed particle effect requires a newer version
|
* Represents a runtime exception that is thrown if the displayed particle effect requires a newer version
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1299,7 +1298,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a particle effect packet with all attributes which is used for sending packets to the players
|
* Represents a particle effect packet with all attributes which is used for sending packets to the players
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1385,7 +1384,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes {@link #packetConstructor}, {@link #getHandle}, {@link #playerConnection} and {@link #sendPacket} and sets {@link #initialized} to <code>true</code> if it succeeds
|
* Initializes {@link #packetConstructor}, {@link #getHandle}, {@link #playerConnection} and {@link #sendPacket} and sets {@link #initialized} to <code>true</code> if it succeeds
|
||||||
*
|
*
|
||||||
* <b>Note:</b> These fields only have to be initialized once, so it will return if {@link #initialized} is already set to <code>true</code>
|
* <b>Note:</b> These fields only have to be initialized once, so it will return if {@link #initialized} is already set to <code>true</code>
|
||||||
*
|
*
|
||||||
* @throws VersionIncompatibleException if your bukkit version is not supported by this library
|
* @throws VersionIncompatibleException if your bukkit version is not supported by this library
|
||||||
@ -1532,7 +1531,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that is thrown if a bukkit version is not compatible with this library
|
* Represents a runtime exception that is thrown if a bukkit version is not compatible with this library
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1554,7 +1553,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that is thrown if packet instantiation fails
|
* Represents a runtime exception that is thrown if packet instantiation fails
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -1576,7 +1575,7 @@ public enum ParticleEffect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a runtime exception that is thrown if packet sending fails
|
* Represents a runtime exception that is thrown if packet sending fails
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
|
@ -11,15 +11,15 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>ReflectionUtils</b>
|
* <b>ReflectionUtils</b>
|
||||||
*
|
* <p>
|
||||||
* This class provides useful methods which makes dealing with reflection much easier, especially when working with Bukkit
|
* This class provides useful methods which makes dealing with reflection much easier, especially when working with Bukkit
|
||||||
*
|
* <p>
|
||||||
* You are welcome to use it, modify it and redistribute it under the following conditions:
|
* You are welcome to use it, modify it and redistribute it under the following conditions:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Don't claim this class as your own
|
* <li>Don't claim this class as your own
|
||||||
* <li>Don't remove this disclaimer
|
* <li>Don't remove this disclaimer
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <i>It would be nice if you provide credit to me if you use this class in a published project</i>
|
* <i>It would be nice if you provide credit to me if you use this class in a published project</i>
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -346,7 +346,7 @@ public final class ReflectionUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an enumeration of dynamic packages of NMS and CraftBukkit
|
* Represents an enumeration of dynamic packages of NMS and CraftBukkit
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
|
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
@ -433,7 +433,7 @@ public final class ReflectionUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an enumeration of Java data types with corresponding classes
|
* Represents an enumeration of Java data types with corresponding classes
|
||||||
*
|
* <p>
|
||||||
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
|
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
|
||||||
*
|
*
|
||||||
* @author DarkBlade12
|
* @author DarkBlade12
|
||||||
|
@ -1,111 +1,111 @@
|
|||||||
package com.massivecraft.factions.util;
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.iface.RelationParticipator;
|
import com.massivecraft.factions.iface.RelationParticipator;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class RelationUtil {
|
public class RelationUtil {
|
||||||
|
|
||||||
public static String describeThatToMe(RelationParticipator that, RelationParticipator me, boolean ucfirst) {
|
public static String describeThatToMe(RelationParticipator that, RelationParticipator me, boolean ucfirst) {
|
||||||
String ret = "";
|
String ret = "";
|
||||||
|
|
||||||
Faction thatFaction = getFaction(that);
|
Faction thatFaction = getFaction(that);
|
||||||
if (thatFaction == null) {
|
if (thatFaction == null) {
|
||||||
return "ERROR"; // ERROR
|
return "ERROR"; // ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
Faction myFaction = getFaction(me);
|
Faction myFaction = getFaction(me);
|
||||||
// if (myFaction == null) return that.describeTo(null); // no relation, but can show basic name or tag
|
// if (myFaction == null) return that.describeTo(null); // no relation, but can show basic name or tag
|
||||||
|
|
||||||
if (that instanceof Faction) {
|
if (that instanceof Faction) {
|
||||||
if (me instanceof FPlayer && myFaction == thatFaction) {
|
if (me instanceof FPlayer && myFaction == thatFaction) {
|
||||||
ret = TL.GENERIC_YOURFACTION.toString();
|
ret = TL.GENERIC_YOURFACTION.toString();
|
||||||
} else {
|
} else {
|
||||||
ret = thatFaction.getTag();
|
ret = thatFaction.getTag();
|
||||||
}
|
}
|
||||||
} else if (that instanceof FPlayer) {
|
} else if (that instanceof FPlayer) {
|
||||||
FPlayer fplayerthat = (FPlayer) that;
|
FPlayer fplayerthat = (FPlayer) that;
|
||||||
if (that == me) {
|
if (that == me) {
|
||||||
ret = TL.GENERIC_YOU.toString();
|
ret = TL.GENERIC_YOU.toString();
|
||||||
} else if (thatFaction == myFaction) {
|
} else if (thatFaction == myFaction) {
|
||||||
ret = fplayerthat.getNameAndTitle();
|
ret = fplayerthat.getNameAndTitle();
|
||||||
} else {
|
} else {
|
||||||
ret = fplayerthat.getNameAndTag();
|
ret = fplayerthat.getNameAndTag();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ucfirst) {
|
if (ucfirst) {
|
||||||
ret = TextUtil.upperCaseFirst(ret);
|
ret = TextUtil.upperCaseFirst(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "" + getColorOfThatToMe(that, me) + ret;
|
return "" + getColorOfThatToMe(that, me) + ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String describeThatToMe(RelationParticipator that, RelationParticipator me) {
|
public static String describeThatToMe(RelationParticipator that, RelationParticipator me) {
|
||||||
return describeThatToMe(that, me, false);
|
return describeThatToMe(that, me, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Relation getRelationTo(RelationParticipator me, RelationParticipator that) {
|
public static Relation getRelationTo(RelationParticipator me, RelationParticipator that) {
|
||||||
return getRelationTo(that, me, false);
|
return getRelationTo(that, me, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Relation getRelationTo(RelationParticipator me, RelationParticipator that, boolean ignorePeaceful) {
|
public static Relation getRelationTo(RelationParticipator me, RelationParticipator that, boolean ignorePeaceful) {
|
||||||
Faction fthat = getFaction(that);
|
Faction fthat = getFaction(that);
|
||||||
Faction fme = getFaction(me);
|
Faction fme = getFaction(me);
|
||||||
|
|
||||||
if (fthat == null || fme == null) {
|
if (fthat == null || fme == null) {
|
||||||
return Relation.NEUTRAL; // ERROR
|
return Relation.NEUTRAL; // ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fthat.isNormal() || !fme.isNormal()) {
|
if (!fthat.isNormal() || !fme.isNormal()) {
|
||||||
return Relation.NEUTRAL;
|
return Relation.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fthat.equals(fme)) {
|
if (fthat.equals(fme)) {
|
||||||
return Relation.MEMBER;
|
return Relation.MEMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignorePeaceful && (fme.isPeaceful() || fthat.isPeaceful())) {
|
if (!ignorePeaceful && (fme.isPeaceful() || fthat.isPeaceful())) {
|
||||||
return Relation.NEUTRAL;
|
return Relation.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fme.getRelationWish(fthat).value >= fthat.getRelationWish(fme).value) {
|
if (fme.getRelationWish(fthat).value >= fthat.getRelationWish(fme).value) {
|
||||||
return fthat.getRelationWish(fme);
|
return fthat.getRelationWish(fme);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fme.getRelationWish(fthat);
|
return fme.getRelationWish(fthat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Faction getFaction(RelationParticipator rp) {
|
public static Faction getFaction(RelationParticipator rp) {
|
||||||
if (rp instanceof Faction) {
|
if (rp instanceof Faction) {
|
||||||
return (Faction) rp;
|
return (Faction) rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rp instanceof FPlayer) {
|
if (rp instanceof FPlayer) {
|
||||||
return ((FPlayer) rp).getFaction();
|
return ((FPlayer) rp).getFaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ERROR
|
// ERROR
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatColor getColorOfThatToMe(RelationParticipator that, RelationParticipator me) {
|
public static ChatColor getColorOfThatToMe(RelationParticipator that, RelationParticipator me) {
|
||||||
Faction thatFaction = getFaction(that);
|
Faction thatFaction = getFaction(that);
|
||||||
|
|
||||||
if (thatFaction != null && thatFaction != getFaction(me)) {
|
if (thatFaction != null && thatFaction != getFaction(me)) {
|
||||||
if (thatFaction.isPeaceful())
|
if (thatFaction.isPeaceful())
|
||||||
return Conf.colorPeaceful;
|
return Conf.colorPeaceful;
|
||||||
else if (thatFaction.isSafeZone())
|
else if (thatFaction.isSafeZone())
|
||||||
return Conf.colorPeaceful;
|
return Conf.colorPeaceful;
|
||||||
else if (thatFaction.isWarZone())
|
else if (thatFaction.isWarZone())
|
||||||
return Conf.colorWar;
|
return Conf.colorWar;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getRelationTo(that, me).getColor();
|
return getRelationTo(that, me).getColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public abstract class SpiralTask implements Runnable {
|
|||||||
// general task-related reference data
|
// general task-related reference data
|
||||||
private transient World world = null;
|
private transient World world = null;
|
||||||
private transient boolean readyToGo = false;
|
private transient boolean readyToGo = false;
|
||||||
private transient int taskID = - 1;
|
private transient int taskID = -1;
|
||||||
private transient int limit = 0;
|
private transient int limit = 0;
|
||||||
|
|
||||||
// values for the spiral pattern routine
|
// values for the spiral pattern routine
|
||||||
@ -35,10 +35,10 @@ public abstract class SpiralTask implements Runnable {
|
|||||||
private transient int z = 0;
|
private transient int z = 0;
|
||||||
private transient boolean isZLeg = false;
|
private transient boolean isZLeg = false;
|
||||||
private transient boolean isNeg = false;
|
private transient boolean isNeg = false;
|
||||||
private transient int length = - 1;
|
private transient int length = -1;
|
||||||
private transient int current = 0;
|
private transient int current = 0;
|
||||||
|
|
||||||
@SuppressWarnings ("LeakingThisInConstructor")
|
@SuppressWarnings("LeakingThisInConstructor")
|
||||||
public SpiralTask(FLocation fLocation, int radius) {
|
public SpiralTask(FLocation fLocation, int radius) {
|
||||||
// limit is determined based on spiral leg length for given radius; see insideRadius()
|
// limit is determined based on spiral leg length for given radius; see insideRadius()
|
||||||
this.limit = (radius - 1) * 2;
|
this.limit = (radius - 1) * 2;
|
||||||
@ -103,7 +103,7 @@ public abstract class SpiralTask implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setTaskID(int ID) {
|
public final void setTaskID(int ID) {
|
||||||
if (ID == - 1) {
|
if (ID == -1) {
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
taskID = ID;
|
taskID = ID;
|
||||||
@ -169,9 +169,9 @@ public abstract class SpiralTask implements Runnable {
|
|||||||
|
|
||||||
// move one chunk further in the appropriate direction
|
// move one chunk further in the appropriate direction
|
||||||
if (isZLeg) {
|
if (isZLeg) {
|
||||||
z += (isNeg) ? - 1 : 1;
|
z += (isNeg) ? -1 : 1;
|
||||||
} else {
|
} else {
|
||||||
x += (isNeg) ? - 1 : 1;
|
x += (isNeg) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -199,11 +199,11 @@ public abstract class SpiralTask implements Runnable {
|
|||||||
|
|
||||||
readyToGo = false;
|
readyToGo = false;
|
||||||
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
||||||
taskID = - 1;
|
taskID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// is this task still valid/workable?
|
// is this task still valid/workable?
|
||||||
public final boolean valid() {
|
public final boolean valid() {
|
||||||
return taskID != - 1;
|
return taskID != -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
114
src/main/java/com/massivecraft/factions/util/UtilFly.java
Normal file
114
src/main/java/com/massivecraft/factions/util/UtilFly.java
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.SavageFactions;
|
||||||
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
public class UtilFly {
|
||||||
|
|
||||||
|
public static ArrayList<FPlayer> playersFlying;
|
||||||
|
|
||||||
|
static {
|
||||||
|
playersFlying = SavageFactions.playersFlying;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UtilFly() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void run() {
|
||||||
|
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {
|
||||||
|
playersFlying.clear();
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
Iterator var2 = UtilFly.playersFlying.iterator();
|
||||||
|
|
||||||
|
while (var2.hasNext()) {
|
||||||
|
FPlayer fp = (FPlayer) var2.next();
|
||||||
|
if (fp != null) {
|
||||||
|
fp.checkIfNearbyEnemies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, 0L, (long) SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
|
||||||
|
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {
|
||||||
|
fp.getPlayer().setAllowFlight(fly);
|
||||||
|
fp.getPlayer().setFlying(fly);
|
||||||
|
fp.setFlying(fly);
|
||||||
|
if (fly) {
|
||||||
|
playersFlying.add(fp);
|
||||||
|
} else {
|
||||||
|
playersFlying.remove(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!silent) {
|
||||||
|
if (!damage) {
|
||||||
|
fp.msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
||||||
|
} else {
|
||||||
|
fp.msg(TL.COMMAND_FLY_DAMAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setFallDamage(fp, fly, damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkFly(FPlayer me, Faction factionTo) {
|
||||||
|
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {
|
||||||
|
if (!me.isAdminBypassing() || !me.isFlying()) {
|
||||||
|
Relation relationTo;
|
||||||
|
if (!me.isFlying()) {
|
||||||
|
if (me.isAdminBypassing()) {
|
||||||
|
setFly(me, true, false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (factionTo == me.getFaction() && me.getPlayer().hasPermission("factions.fly")) {
|
||||||
|
setFly(me, true, false, false);
|
||||||
|
} else {
|
||||||
|
relationTo = factionTo.getRelationTo(me);
|
||||||
|
if (factionTo.isWilderness() && me.canflyinWilderness() || factionTo.isWarZone() && me.canflyinWarzone() || factionTo.isSafeZone() && me.canflyinSafezone() || relationTo == Relation.ENEMY && me.canflyinEnemy() || relationTo == Relation.ALLY && me.canflyinAlly() || relationTo == Relation.TRUCE && me.canflyinTruce() || relationTo == Relation.NEUTRAL && me.canflyinNeutral()) {
|
||||||
|
setFly(me, true, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
relationTo = factionTo.getRelationTo(me);
|
||||||
|
if (factionTo.equals(me.getFaction()) && !me.getPlayer().hasPermission("factions.fly") || factionTo.isWilderness() && !me.canflyinWilderness() || factionTo.isWarZone() && !me.canflyinWarzone() || factionTo.isSafeZone() && !me.canflyinSafezone() || relationTo == Relation.ENEMY && !me.canflyinEnemy() || relationTo == Relation.ALLY && !me.canflyinAlly() || relationTo == Relation.TRUCE && !me.canflyinTruce() || relationTo == Relation.NEUTRAL && !me.canflyinNeutral()) {
|
||||||
|
setFly(me, false, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFallDamage(final FPlayer fp, boolean fly, boolean damage) {
|
||||||
|
if (!fly) {
|
||||||
|
if (!damage) {
|
||||||
|
fp.sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", String.valueOf(SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3))));
|
||||||
|
}
|
||||||
|
|
||||||
|
int cooldown = SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3);
|
||||||
|
if (cooldown > 0) {
|
||||||
|
fp.setTakeFallDamage(false);
|
||||||
|
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fp.setTakeFallDamage(true);
|
||||||
|
}
|
||||||
|
}, 20L * (long) cooldown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,72 +1,72 @@
|
|||||||
package com.massivecraft.factions.util;
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class VisualizeUtil {
|
public class VisualizeUtil {
|
||||||
|
|
||||||
protected static Map<UUID, Set<Location>> playerLocations = new HashMap<>();
|
protected static Map<UUID, Set<Location>> playerLocations = new HashMap<>();
|
||||||
|
|
||||||
public static Set<Location> getPlayerLocations(Player player) {
|
public static Set<Location> getPlayerLocations(Player player) {
|
||||||
return getPlayerLocations(player.getUniqueId());
|
return getPlayerLocations(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Location> getPlayerLocations(UUID uuid) {
|
public static Set<Location> getPlayerLocations(UUID uuid) {
|
||||||
Set<Location> ret = playerLocations.get(uuid);
|
Set<Location> ret = playerLocations.get(uuid);
|
||||||
if (ret == null) {
|
if (ret == null) {
|
||||||
ret = new HashSet<>();
|
ret = new HashSet<>();
|
||||||
playerLocations.put(uuid, ret);
|
playerLocations.put(uuid, ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings ("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void addLocation(Player player, Location location, Material type, byte data) {
|
public static void addLocation(Player player, Location location, Material type, byte data) {
|
||||||
getPlayerLocations(player).add(location);
|
getPlayerLocations(player).add(location);
|
||||||
player.sendBlockChange(location, type, data);
|
player.sendBlockChange(location, type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings ("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void addLocation(Player player, Location location, Material material) {
|
public static void addLocation(Player player, Location location, Material material) {
|
||||||
getPlayerLocations(player).add(location);
|
getPlayerLocations(player).add(location);
|
||||||
player.sendBlockChange(location, material, (byte) 0);
|
player.sendBlockChange(location, material, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings ("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void addLocations(Player player, Collection<Location> locations, Material material) {
|
public static void addLocations(Player player, Collection<Location> locations, Material material) {
|
||||||
Set<Location> ploc = getPlayerLocations(player);
|
Set<Location> ploc = getPlayerLocations(player);
|
||||||
for (Location location : locations) {
|
for (Location location : locations) {
|
||||||
ploc.add(location);
|
ploc.add(location);
|
||||||
player.sendBlockChange(location, material, (byte) 0);
|
player.sendBlockChange(location, material, (byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings ("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void addBlocks(Player player, Collection<Block> blocks, Material material) {
|
public static void addBlocks(Player player, Collection<Block> blocks, Material material) {
|
||||||
Set<Location> ploc = getPlayerLocations(player);
|
Set<Location> ploc = getPlayerLocations(player);
|
||||||
for (Block block : blocks) {
|
for (Block block : blocks) {
|
||||||
Location location = block.getLocation();
|
Location location = block.getLocation();
|
||||||
ploc.add(location);
|
ploc.add(location);
|
||||||
player.sendBlockChange(location, material, (byte) 0);
|
player.sendBlockChange(location, material, (byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings ("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void clear(Player player) {
|
public static void clear(Player player) {
|
||||||
Set<Location> locations = getPlayerLocations(player);
|
Set<Location> locations = getPlayerLocations(player);
|
||||||
if (locations == null) {
|
if (locations == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Location location : locations) {
|
for (Location location : locations) {
|
||||||
Block block = location.getWorld().getBlockAt(location);
|
Block block = location.getWorld().getBlockAt(location);
|
||||||
player.sendBlockChange(location, block.getType(), block.getData());
|
player.sendBlockChange(location, block.getType(), block.getData());
|
||||||
}
|
}
|
||||||
locations.clear();
|
locations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class WarmUpUtil {
|
|||||||
* @param action The action, inserted into the notification message.
|
* @param action The action, inserted into the notification message.
|
||||||
* @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran.
|
* @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran.
|
||||||
* @param delay The time used, in seconds, for the delay.
|
* @param delay The time used, in seconds, for the delay.
|
||||||
*
|
* <p>
|
||||||
* note: for translations: %s = action, %d = delay
|
* note: for translations: %s = action, %d = delay
|
||||||
*/
|
*/
|
||||||
public static void process(final FPlayer player, Warmup warmup, TL translationKey, String action, final Runnable runnable, long delay) {
|
public static void process(final FPlayer player, Warmup warmup, TL translationKey, String action, final Runnable runnable, long delay) {
|
||||||
|
@ -140,9 +140,9 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
|
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
|
||||||
return Econ.modifyMoney(fme.getFaction(), - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
return Econ.modifyMoney(fme.getFaction(), -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||||
} else {
|
} else {
|
||||||
return Econ.modifyMoney(fme, - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
return Econ.modifyMoney(fme, -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public abstract class MCommand<T extends MPlugin> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getHelpShort() {
|
public String getHelpShort() {
|
||||||
return this.helpShort != null ? this.helpShort:getUsageTranslation().toString();
|
return this.helpShort != null ? this.helpShort : getUsageTranslation().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHelpShort(String val) {
|
public void setHelpShort(String val) {
|
||||||
@ -85,9 +85,8 @@ public abstract class MCommand<T extends MPlugin> {
|
|||||||
|
|
||||||
public abstract TL getUsageTranslation();
|
public abstract TL getUsageTranslation();
|
||||||
|
|
||||||
public void setCommandSender(CommandSender sender)
|
public void setCommandSender(CommandSender sender) {
|
||||||
{
|
this.sender = sender;
|
||||||
this.sender = sender;
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
this.me = (Player) sender;
|
this.me = (Player) sender;
|
||||||
this.senderIsConsole = false;
|
this.senderIsConsole = false;
|
||||||
@ -96,7 +95,7 @@ public abstract class MCommand<T extends MPlugin> {
|
|||||||
this.senderIsConsole = true;
|
this.senderIsConsole = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The commandChain is a list of the parent command chain used to get to this command.
|
// The commandChain is a list of the parent command chain used to get to this command.
|
||||||
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
|
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
|
||||||
// Set the execution-time specific variables
|
// Set the execution-time specific variables
|
||||||
|
@ -1,339 +1,339 @@
|
|||||||
package com.massivecraft.factions.zcore;
|
package com.massivecraft.factions.zcore;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.zcore.persist.SaveTask;
|
import com.massivecraft.factions.zcore.persist.SaveTask;
|
||||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||||
import com.massivecraft.factions.zcore.util.Persist;
|
import com.massivecraft.factions.zcore.util.Persist;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
|
||||||
public abstract class MPlugin extends JavaPlugin {
|
public abstract class MPlugin extends JavaPlugin {
|
||||||
|
|
||||||
// Persist related
|
// Persist related
|
||||||
public final Gson gson = this.getGsonBuilder().create();
|
public final Gson gson = this.getGsonBuilder().create();
|
||||||
// Some utils
|
// Some utils
|
||||||
public Persist persist;
|
public Persist persist;
|
||||||
public TextUtil txt;
|
public TextUtil txt;
|
||||||
public PermUtil perm;
|
public PermUtil perm;
|
||||||
public String refCommand = "";
|
public String refCommand = "";
|
||||||
//holds f stuck taskids
|
//holds f stuck taskids
|
||||||
public Map<UUID, Integer> stuckMap = new HashMap<>();
|
public Map<UUID, Integer> stuckMap = new HashMap<>();
|
||||||
// These are not supposed to be used directly.
|
// These are not supposed to be used directly.
|
||||||
// They are loaded and used through the TextUtil instance for the plugin.
|
// They are loaded and used through the TextUtil instance for the plugin.
|
||||||
public Map<String, String> rawTags = new LinkedHashMap<>();
|
public Map<String, String> rawTags = new LinkedHashMap<>();
|
||||||
protected boolean loadSuccessful = false;
|
protected boolean loadSuccessful = false;
|
||||||
private Integer saveTask = null;
|
private Integer saveTask = null;
|
||||||
private boolean autoSave = true;
|
private boolean autoSave = true;
|
||||||
// Listeners
|
// Listeners
|
||||||
private MPluginSecretPlayerListener mPluginSecretPlayerListener;
|
private MPluginSecretPlayerListener mPluginSecretPlayerListener;
|
||||||
|
|
||||||
// Our stored base commands
|
// Our stored base commands
|
||||||
private List<MCommand<?>> baseCommands = new ArrayList<>();
|
private List<MCommand<?>> baseCommands = new ArrayList<>();
|
||||||
// holds f stuck start times
|
// holds f stuck start times
|
||||||
private Map<UUID, Long> timers = new HashMap<>();
|
private Map<UUID, Long> timers = new HashMap<>();
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// ENABLE
|
// ENABLE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
private long timeEnableStart;
|
private long timeEnableStart;
|
||||||
|
|
||||||
public boolean getAutoSave() {
|
public boolean getAutoSave() {
|
||||||
return this.autoSave;
|
return this.autoSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoSave(boolean val) {
|
public void setAutoSave(boolean val) {
|
||||||
this.autoSave = val;
|
this.autoSave = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MCommand<?>> getBaseCommands() {
|
public List<MCommand<?>> getBaseCommands() {
|
||||||
return this.baseCommands;
|
return this.baseCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean preEnable() {
|
public boolean preEnable() {
|
||||||
log("=== ENABLE START ===");
|
log("=== ENABLE START ===");
|
||||||
timeEnableStart = System.currentTimeMillis();
|
timeEnableStart = System.currentTimeMillis();
|
||||||
|
|
||||||
// Ensure basefolder exists!
|
// Ensure basefolder exists!
|
||||||
this.getDataFolder().mkdirs();
|
this.getDataFolder().mkdirs();
|
||||||
|
|
||||||
// Create Utility Instances
|
// Create Utility Instances
|
||||||
this.perm = new PermUtil(this);
|
this.perm = new PermUtil(this);
|
||||||
this.persist = new Persist(this);
|
this.persist = new Persist(this);
|
||||||
|
|
||||||
this.txt = new TextUtil();
|
this.txt = new TextUtil();
|
||||||
initTXT();
|
initTXT();
|
||||||
|
|
||||||
// attempt to get first command defined in plugin.yml as reference command, if any commands are defined in there
|
// attempt to get first command defined in plugin.yml as reference command, if any commands are defined in there
|
||||||
// reference command will be used to prevent "unknown command" console messages
|
// reference command will be used to prevent "unknown command" console messages
|
||||||
try {
|
try {
|
||||||
Map<String, Map<String, Object>> refCmd = this.getDescription().getCommands();
|
Map<String, Map<String, Object>> refCmd = this.getDescription().getCommands();
|
||||||
if (refCmd != null && !refCmd.isEmpty()) {
|
if (refCmd != null && !refCmd.isEmpty()) {
|
||||||
this.refCommand = (String) (refCmd.keySet().toArray()[0]);
|
this.refCommand = (String) (refCmd.keySet().toArray()[0]);
|
||||||
}
|
}
|
||||||
} catch (ClassCastException ex) {
|
} catch (ClassCastException ex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and register player command listener
|
// Create and register player command listener
|
||||||
this.mPluginSecretPlayerListener = new MPluginSecretPlayerListener(this);
|
this.mPluginSecretPlayerListener = new MPluginSecretPlayerListener(this);
|
||||||
getServer().getPluginManager().registerEvents(this.mPluginSecretPlayerListener, this);
|
getServer().getPluginManager().registerEvents(this.mPluginSecretPlayerListener, this);
|
||||||
|
|
||||||
// Register recurring tasks
|
// Register recurring tasks
|
||||||
if (saveTask == null && Conf.saveToFileEveryXMinutes > 0.0) {
|
if (saveTask == null && Conf.saveToFileEveryXMinutes > 0.0) {
|
||||||
long saveTicks = (long) (20 * 60 * Conf.saveToFileEveryXMinutes); // Approximately every 30 min by default
|
long saveTicks = (long) (20 * 60 * Conf.saveToFileEveryXMinutes); // Approximately every 30 min by default
|
||||||
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLang();
|
loadLang();
|
||||||
|
|
||||||
loadSuccessful = true;
|
loadSuccessful = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postEnable() {
|
public void postEnable() {
|
||||||
log("=== ENABLE DONE (Took " + (System.currentTimeMillis() - timeEnableStart) + "ms) ===");
|
log("=== ENABLE DONE (Took " + (System.currentTimeMillis() - timeEnableStart) + "ms) ===");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadLang() {
|
public void loadLang() {
|
||||||
File lang = new File(getDataFolder(), "lang.yml");
|
File lang = new File(getDataFolder(), "lang.yml");
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
InputStream defLangStream = this.getResource("lang.yml");
|
InputStream defLangStream = this.getResource("lang.yml");
|
||||||
if (!lang.exists()) {
|
if (!lang.exists()) {
|
||||||
try {
|
try {
|
||||||
getDataFolder().mkdir();
|
getDataFolder().mkdir();
|
||||||
lang.createNewFile();
|
lang.createNewFile();
|
||||||
if (defLangStream != null) {
|
if (defLangStream != null) {
|
||||||
out = new FileOutputStream(lang);
|
out = new FileOutputStream(lang);
|
||||||
int read;
|
int read;
|
||||||
byte[] bytes = new byte[1024];
|
byte[] bytes = new byte[1024];
|
||||||
|
|
||||||
while ((read = defLangStream.read(bytes)) != - 1) {
|
while ((read = defLangStream.read(bytes)) != -1) {
|
||||||
out.write(bytes, 0, read);
|
out.write(bytes, 0, read);
|
||||||
}
|
}
|
||||||
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(defLangStream)));
|
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(defLangStream)));
|
||||||
TL.setFile(defConfig);
|
TL.setFile(defConfig);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(); // So they notice
|
e.printStackTrace(); // So they notice
|
||||||
getLogger().severe("[Factions] Couldn't create language file.");
|
getLogger().severe("[Factions] Couldn't create language file.");
|
||||||
getLogger().severe("[Factions] This is a fatal error. Now disabling");
|
getLogger().severe("[Factions] This is a fatal error. Now disabling");
|
||||||
this.setEnabled(false); // Without it loaded, we can't send them messages
|
this.setEnabled(false); // Without it loaded, we can't send them messages
|
||||||
} finally {
|
} finally {
|
||||||
if (defLangStream != null) {
|
if (defLangStream != null) {
|
||||||
try {
|
try {
|
||||||
defLangStream.close();
|
defLangStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(lang);
|
YamlConfiguration conf = YamlConfiguration.loadConfiguration(lang);
|
||||||
for (TL item : TL.values()) {
|
for (TL item : TL.values()) {
|
||||||
if (conf.getString(item.getPath()) == null) {
|
if (conf.getString(item.getPath()) == null) {
|
||||||
conf.set(item.getPath(), item.getDefault());
|
conf.set(item.getPath(), item.getDefault());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove this here because I'm sick of dealing with bug reports due to bad decisions on my part.
|
// Remove this here because I'm sick of dealing with bug reports due to bad decisions on my part.
|
||||||
if (conf.getString(TL.COMMAND_SHOW_POWER.getPath(), "").contains("%5$s")) {
|
if (conf.getString(TL.COMMAND_SHOW_POWER.getPath(), "").contains("%5$s")) {
|
||||||
conf.set(TL.COMMAND_SHOW_POWER.getPath(), TL.COMMAND_SHOW_POWER.getDefault());
|
conf.set(TL.COMMAND_SHOW_POWER.getPath(), TL.COMMAND_SHOW_POWER.getDefault());
|
||||||
log(Level.INFO, "Removed errant format specifier from f show power.");
|
log(Level.INFO, "Removed errant format specifier from f show power.");
|
||||||
}
|
}
|
||||||
|
|
||||||
TL.setFile(conf);
|
TL.setFile(conf);
|
||||||
try {
|
try {
|
||||||
conf.save(lang);
|
conf.save(lang);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().log(Level.WARNING, "Factions: Failed to save lang.yml.");
|
getLogger().log(Level.WARNING, "Factions: Failed to save lang.yml.");
|
||||||
getLogger().log(Level.WARNING, "Factions: Report this stack trace to prosavage.");
|
getLogger().log(Level.WARNING, "Factions: Report this stack trace to prosavage.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (saveTask != null) {
|
if (saveTask != null) {
|
||||||
this.getServer().getScheduler().cancelTask(saveTask);
|
this.getServer().getScheduler().cancelTask(saveTask);
|
||||||
saveTask = null;
|
saveTask = null;
|
||||||
}
|
}
|
||||||
// only save data if plugin actually loaded successfully
|
// only save data if plugin actually loaded successfully
|
||||||
if (loadSuccessful) {
|
if (loadSuccessful) {
|
||||||
Factions.getInstance().forceSave();
|
Factions.getInstance().forceSave();
|
||||||
FPlayers.getInstance().forceSave();
|
FPlayers.getInstance().forceSave();
|
||||||
Board.getInstance().forceSave();
|
Board.getInstance().forceSave();
|
||||||
}
|
}
|
||||||
log("Disabled");
|
log("Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Some inits...
|
// Some inits...
|
||||||
// You are supposed to override these in the plugin if you aren't satisfied with the defaults
|
// You are supposed to override these in the plugin if you aren't satisfied with the defaults
|
||||||
// The goal is that you always will be satisfied though.
|
// The goal is that you always will be satisfied though.
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void suicide() {
|
public void suicide() {
|
||||||
log("Now I suicide!");
|
log("Now I suicide!");
|
||||||
this.getServer().getPluginManager().disablePlugin(this);
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// LANG AND TAGS
|
// LANG AND TAGS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public GsonBuilder getGsonBuilder() {
|
public GsonBuilder getGsonBuilder() {
|
||||||
return new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().serializeNulls().excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE);
|
return new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().serializeNulls().excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRawTags() {
|
public void addRawTags() {
|
||||||
this.rawTags.put("l", "<green>"); // logo
|
this.rawTags.put("l", "<green>"); // logo
|
||||||
this.rawTags.put("a", "<gold>"); // art
|
this.rawTags.put("a", "<gold>"); // art
|
||||||
this.rawTags.put("n", "<silver>"); // notice
|
this.rawTags.put("n", "<silver>"); // notice
|
||||||
this.rawTags.put("i", "<yellow>"); // info
|
this.rawTags.put("i", "<yellow>"); // info
|
||||||
this.rawTags.put("g", "<lime>"); // good
|
this.rawTags.put("g", "<lime>"); // good
|
||||||
this.rawTags.put("b", "<rose>"); // bad
|
this.rawTags.put("b", "<rose>"); // bad
|
||||||
this.rawTags.put("h", "<pink>"); // highligh
|
this.rawTags.put("h", "<pink>"); // highligh
|
||||||
this.rawTags.put("c", "<aqua>"); // command
|
this.rawTags.put("c", "<aqua>"); // command
|
||||||
this.rawTags.put("plugin", "<teal>"); // parameter
|
this.rawTags.put("plugin", "<teal>"); // parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTXT() {
|
public void initTXT() {
|
||||||
this.addRawTags();
|
this.addRawTags();
|
||||||
|
|
||||||
Type type = new TypeToken<Map<String, String>>() {
|
Type type = new TypeToken<Map<String, String>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
|
||||||
Map<String, String> tagsFromFile = this.persist.load(type, "tags");
|
Map<String, String> tagsFromFile = this.persist.load(type, "tags");
|
||||||
if (tagsFromFile != null) {
|
if (tagsFromFile != null) {
|
||||||
this.rawTags.putAll(tagsFromFile);
|
this.rawTags.putAll(tagsFromFile);
|
||||||
}
|
}
|
||||||
this.persist.save(this.rawTags, "tags");
|
this.persist.save(this.rawTags, "tags");
|
||||||
|
|
||||||
for (Entry<String, String> rawTag : this.rawTags.entrySet()) {
|
for (Entry<String, String> rawTag : this.rawTags.entrySet()) {
|
||||||
this.txt.tags.put(rawTag.getKey(), TextUtil.parseColor(rawTag.getValue()));
|
this.txt.tags.put(rawTag.getKey(), TextUtil.parseColor(rawTag.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// COMMAND HANDLING
|
// COMMAND HANDLING
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// can be overridden by SavageFactions method, to provide option
|
// can be overridden by SavageFactions method, to provide option
|
||||||
public boolean logPlayerCommands() {
|
public boolean logPlayerCommands() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) {
|
public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) {
|
||||||
return handleCommand(sender, commandString, testOnly, false);
|
return handleCommand(sender, commandString, testOnly, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleCommand(final CommandSender sender, String commandString, boolean testOnly, boolean async) {
|
public boolean handleCommand(final CommandSender sender, String commandString, boolean testOnly, boolean async) {
|
||||||
boolean noSlash = true;
|
boolean noSlash = true;
|
||||||
if (commandString.startsWith("/")) {
|
if (commandString.startsWith("/")) {
|
||||||
noSlash = false;
|
noSlash = false;
|
||||||
commandString = commandString.substring(1);
|
commandString = commandString.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final MCommand<?> command : this.getBaseCommands()) {
|
for (final MCommand<?> command : this.getBaseCommands()) {
|
||||||
if (noSlash && !command.allowNoSlashAccess) {
|
if (noSlash && !command.allowNoSlashAccess) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String alias : command.aliases) {
|
for (String alias : command.aliases) {
|
||||||
// disallow double-space after alias, so specific commands can be prevented (preventing "f home" won't prevent "f home")
|
// disallow double-space after alias, so specific commands can be prevented (preventing "f home" won't prevent "f home")
|
||||||
if (commandString.startsWith(alias + " ")) {
|
if (commandString.startsWith(alias + " ")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandString.startsWith(alias + " ") || commandString.equals(alias)) {
|
if (commandString.startsWith(alias + " ") || commandString.equals(alias)) {
|
||||||
final List<String> args = new ArrayList<>(Arrays.asList(commandString.split("\\s+")));
|
final List<String> args = new ArrayList<>(Arrays.asList(commandString.split("\\s+")));
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
|
|
||||||
if (testOnly) {
|
if (testOnly) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (async) {
|
if (async) {
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
command.execute(sender, args);
|
command.execute(sender, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
command.execute(sender, args);
|
command.execute(sender, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleCommand(CommandSender sender, String commandString) {
|
public boolean handleCommand(CommandSender sender, String commandString) {
|
||||||
return this.handleCommand(sender, commandString, false);
|
return this.handleCommand(sender, commandString, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// HOOKS
|
// HOOKS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
public void preAutoSave() {
|
public void preAutoSave() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postAutoSave() {
|
public void postAutoSave() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<UUID, Integer> getStuckMap() {
|
public Map<UUID, Integer> getStuckMap() {
|
||||||
return this.stuckMap;
|
return this.stuckMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<UUID, Long> getTimers() {
|
public Map<UUID, Long> getTimers() {
|
||||||
return this.timers;
|
return this.timers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// LOGGING
|
// LOGGING
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
public void log(Object msg) {
|
public void log(Object msg) {
|
||||||
log(Level.INFO, msg);
|
log(Level.INFO, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(String str, Object... args) {
|
public void log(String str, Object... args) {
|
||||||
log(Level.INFO, this.txt.parse(str, args));
|
log(Level.INFO, this.txt.parse(str, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(Level level, String str, Object... args) {
|
public void log(Level level, String str, Object... args) {
|
||||||
log(level, this.txt.parse(str, args));
|
log(level, this.txt.parse(str, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(Level level, Object msg) {
|
public void log(Level level, Object msg) {
|
||||||
getLogger().log(level, "[" + this.getDescription().getFullName() + "] " + msg);
|
getLogger().log(level, "[" + this.getDescription().getFullName() + "] " + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
package com.massivecraft.factions.zcore;
|
package com.massivecraft.factions.zcore;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
|
|
||||||
public class MPluginSecretPlayerListener implements Listener {
|
public class MPluginSecretPlayerListener implements Listener {
|
||||||
|
|
||||||
private MPlugin p;
|
private MPlugin p;
|
||||||
|
|
||||||
public MPluginSecretPlayerListener(MPlugin p) {
|
public MPluginSecretPlayerListener(MPlugin p) {
|
||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
if (FactionsPlayerListener.preventCommand(event.getMessage(), event.getPlayer())) {
|
if (FactionsPlayerListener.preventCommand(event.getMessage(), event.getPlayer())) {
|
||||||
if (p.logPlayerCommands()) {
|
if (p.logPlayerCommands()) {
|
||||||
Bukkit.getLogger().info("[PLAYER_COMMAND] " + event.getPlayer().getName() + ": " + event.getMessage());
|
Bukkit.getLogger().info("[PLAYER_COMMAND] " + event.getPlayer().getName() + ": " + event.getMessage());
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
if (p.handleCommand(event.getPlayer(), event.getMessage(), false, true)) {
|
if (p.handleCommand(event.getPlayer(), event.getMessage(), false, true)) {
|
||||||
if (p.logPlayerCommands()) {
|
if (p.logPlayerCommands()) {
|
||||||
Bukkit.getLogger().info("[PLAYER_COMMAND] " + event.getPlayer().getName() + ": " + event.getMessage());
|
Bukkit.getLogger().info("[PLAYER_COMMAND] " + event.getPlayer().getName() + ": " + event.getMessage());
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should be handled by stuff in FactionsChatListener
|
/* Should be handled by stuff in FactionsChatListener
|
||||||
Player speaker = event.getPlayer();
|
Player speaker = event.getPlayer();
|
||||||
String format = event.getFormat();
|
String format = event.getFormat();
|
||||||
format = format.replace(Conf.chatTagReplaceString, SavageFactions.plugin.getPlayerFactionTag(speaker)).replace("[FACTION_TITLE]", SavageFactions.plugin.getPlayerTitle(speaker));
|
format = format.replace(Conf.chatTagReplaceString, SavageFactions.plugin.getPlayerFactionTag(speaker)).replace("[FACTION_TITLE]", SavageFactions.plugin.getPlayerTitle(speaker));
|
||||||
event.setFormat(format);
|
event.setFormat(format);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerPreLogin(PlayerLoginEvent event) {
|
public void onPlayerPreLogin(PlayerLoginEvent event) {
|
||||||
FPlayers.getInstance().getByPlayer(event.getPlayer());
|
FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public interface Permissable {
|
public interface Permissable {
|
||||||
|
|
||||||
public ItemStack buildItem();
|
ItemStack buildItem();
|
||||||
|
|
||||||
public String replacePlaceholders(String string);
|
String replacePlaceholders(String string);
|
||||||
|
|
||||||
public String name();
|
String name();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user