Saber Factions Initiated

This commit is contained in:
Driftay
2019-06-28 21:49:46 -04:00
parent 1fd3220e5e
commit 2c5a501d0e
120 changed files with 676 additions and 743 deletions

View File

@@ -50,13 +50,13 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
// Check if they should be exempt from this.
if (!fplayer.willAutoLeave()) {
SavageFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to.");
SaberFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to.");
continue;
}
if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis) {
if (Conf.logFactionLeave || Conf.logFactionKick) {
SavageFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity.");
SaberFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity.");
}
// if player is faction admin, sort out the faction since he's going away

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
public class AutoLeaveTask implements Runnable {
@@ -18,11 +18,11 @@ public class AutoLeaveTask implements Runnable {
}
task = new AutoLeaveProcessTask();
task.runTaskTimer(SavageFactions.plugin, 1, 1);
task.runTaskTimer(SaberFactions.plugin, 1, 1);
// maybe setting has been changed? if so, restart this task at new rate
if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) {
SavageFactions.plugin.startAutoLeaveTask(true);
SaberFactions.plugin.startAutoLeaveTask(true);
}
}
}

View File

@@ -35,7 +35,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
// Return the plugin version since this expansion is bundled with the dependency
@Override
public String getVersion() {
return SavageFactions.plugin.getDescription().getVersion();
return SaberFactions.plugin.getDescription().getVersion();
}
@@ -80,7 +80,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fPlayer.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
return fPlayer.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fPlayer.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
case "player_group":
return SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId())));
return SaberFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId())));
case "player_balance":
return Econ.isSetup() ? Econ.getFriendlyBalance(fPlayer) : TL.ECON_OFF.format("balance");
case "player_power":
@@ -121,7 +121,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
case "faction_warps":
return String.valueOf(faction.getWarps().size());
case "faction_raidable":
boolean raid = SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded();
boolean raid = SaberFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded();
return raid ? TL.RAIDABLE_TRUE.toString() : TL.RAIDABLE_FALSE.toString();
case "faction_home_world":
return faction.hasHome() ? faction.getHome().getWorld().getName() : "";

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
import com.google.gson.*;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -21,7 +21,7 @@ public class LocationTypeAdapter implements JsonSerializer<Location>, JsonDeseri
return object;
} catch (Exception ex) {
ex.printStackTrace();
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location.");
SaberFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location.");
return object;
}
}
@@ -38,7 +38,7 @@ public class LocationTypeAdapter implements JsonSerializer<Location>, JsonDeseri
object.get("z").getAsDouble());
} catch (Exception ex) {
ex.printStackTrace();
SavageFactions.plugin.log(Level.WARNING, "Error encountered while" +
SaberFactions.plugin.log(Level.WARNING, "Error encountered while" +
" deserializing a Location.");
return null;
}

View File

@@ -2,7 +2,7 @@ package com.massivecraft.factions.util;
import com.google.gson.*;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import java.lang.reflect.Type;
import java.util.HashSet;
@@ -52,7 +52,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
} catch (Exception ex) {
ex.printStackTrace();
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a Map of FLocations to String Sets.");
SaberFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a Map of FLocations to String Sets.");
return null;
}
}
@@ -97,7 +97,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
} catch (Exception ex) {
ex.printStackTrace();
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Map of FLocations to String Sets.");
SaberFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Map of FLocations to String Sets.");
return obj;
}
}

View File

@@ -2,7 +2,7 @@ package com.massivecraft.factions.util;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor;
@@ -68,16 +68,16 @@ public class MiscUtil {
ArrayList<String> errors = new ArrayList<>();
if (getComparisonString(str).length() < Conf.factionTagLengthMin) {
errors.add(SavageFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_TOOSHORT.toString(), Conf.factionTagLengthMin));
errors.add(SaberFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_TOOSHORT.toString(), Conf.factionTagLengthMin));
}
if (str.length() > Conf.factionTagLengthMax) {
errors.add(SavageFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_TOOLONG.toString(), Conf.factionTagLengthMax));
errors.add(SaberFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_TOOLONG.toString(), Conf.factionTagLengthMax));
}
for (char c : str.toCharArray()) {
if (!substanceChars.contains(String.valueOf(c))) {
errors.add(SavageFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
errors.add(SaberFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
}
}
@@ -96,7 +96,7 @@ public class MiscUtil {
// Fix for some data being broken when we added the recruit rank.
if (player.getRole() == null) {
player.setRole(Role.NORMAL);
SavageFactions.plugin.log(Level.WARNING, String.format("Player %s had null role. Setting them to normal. This isn't good D:", player.getName()));
SaberFactions.plugin.log(Level.WARNING, String.format("Player %s had null role. Setting them to normal. This isn't good D:", player.getName()));
}
switch (player.getRole()) {

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
import com.google.gson.*;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import java.lang.reflect.Type;
import java.util.logging.Level;
@@ -32,7 +32,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer<LazyLocation>, Js
} catch (Exception ex) {
ex.printStackTrace();
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a LazyLocation.");
SaberFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a LazyLocation.");
return null;
}
}
@@ -52,7 +52,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer<LazyLocation>, Js
return obj;
} catch (Exception ex) {
ex.printStackTrace();
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a LazyLocation.");
SaberFactions.plugin.log(Level.WARNING, "Error encountered while serializing a LazyLocation.");
return obj;
}
}

View File

@@ -1,6 +1,6 @@
package com.massivecraft.factions.util.Particles;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
@@ -451,7 +451,7 @@ public enum ParticleEffect {
*/
private static boolean isWater(Location location) {
Material material = location.getBlock().getType();
return material == Material.WATER || material == SavageFactions.plugin.STATIONARY_WATER;
return material == Material.WATER || material == SaberFactions.plugin.STATIONARY_WATER;
}
/**

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
import com.google.gson.*;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.fperms.Access;
@@ -62,7 +62,7 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Permissab
return permissionsMap;
} catch (Exception ex) {
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a PermissionsMap.");
SaberFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a PermissionsMap.");
ex.printStackTrace();
return null;
}

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -45,7 +45,7 @@ public abstract class SpiralTask implements Runnable {
this.world = Bukkit.getWorld(fLocation.getWorldName());
if (this.world == null) {
SavageFactions.plugin.log(Level.WARNING, "[SpiralTask] A valid world must be specified!");
SaberFactions.plugin.log(Level.WARNING, "[SpiralTask] A valid world must be specified!");
this.stop();
return;
}
@@ -56,7 +56,7 @@ public abstract class SpiralTask implements Runnable {
this.readyToGo = true;
// get this party started
this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, this, 2, 2));
this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, this, 2, 2));
}
private static long now() {
@@ -187,7 +187,7 @@ public abstract class SpiralTask implements Runnable {
// for successful completion
public void finish() {
// SavageFactions.plugin.log("SpiralTask successfully completed!");
// SaberFactions.plugin.log("SpiralTask successfully completed!");
this.stop();
}

View File

@@ -3,7 +3,7 @@ package com.massivecraft.factions.util;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
@@ -12,18 +12,18 @@ import org.bukkit.Bukkit;
public class UtilFly {
public static void run() {
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
if (!SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return;
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> {
for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) {
if (fp.isFlying()) fp.checkIfNearbyEnemies();
}
}, 0, SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
}, 0, SaberFactions.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"))
if (!SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return;
fp.getPlayer().setAllowFlight(fly);
@@ -43,7 +43,7 @@ public class UtilFly {
}
public static void checkFly(FPlayer me, Faction factionTo) {
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
if (!SaberFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return;
if (me.isAdminBypassing() && me.isFlying())
@@ -81,13 +81,13 @@ public class UtilFly {
public static void setFallDamage(FPlayer fp, boolean fly, boolean damage) {
if (!fly) {
if (!damage) {
fp.sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
fp.sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", SaberFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
}
int cooldown = SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3);
int cooldown = SaberFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3);
if (cooldown > 0) {
fp.setTakeFallDamage(false);
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, () -> fp.setTakeFallDamage(true), 20L * cooldown);
Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> fp.setTakeFallDamage(true), 20L * cooldown);
}
}
}

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.zcore.util.TL;
public class WarmUpUtil {
@@ -21,7 +21,7 @@ public class WarmUpUtil {
player.msg(TL.WARMUPS_ALREADY);
} else {
player.msg(translationKey.format(action, delay));
int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, () -> {
int id = SaberFactions.plugin.getServer().getScheduler().runTaskLater(SaberFactions.plugin, () -> {
player.stopWarmup();
runnable.run();
}, delay * 20).getTaskId();

View File

@@ -3,7 +3,7 @@ package com.massivecraft.factions.util;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
@@ -34,14 +34,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
public WarpGUI(FPlayer fme) {
this.fme = fme;
this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fwarp-gui");
this.section = SaberFactions.plugin.getConfig().getConfigurationSection("fwarp-gui");
}
@Override
public void build() {
if (section == null) {
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
SaberFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
return;
}
@@ -49,14 +49,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
guiSize = section.getInt("rows", 3);
if (guiSize > 6) {
guiSize = 6;
SavageFactions.plugin.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6");
SaberFactions.plugin.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6");
}
guiSize *= 9;
String guiName = ChatColor.translateAlternateColorCodes('&', section.getString("name", "FactionPermissions"));
warpGUI = Bukkit.createInventory(this, guiSize, guiName);
maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5);
maxWarps = SaberFactions.plugin.getConfig().getInt("max-warps", 5);
Set<String> factionWarps = fme.getFaction().getWarps().keySet();
List<Integer> warpOpenSlots = section.getIntegerList("warp-slots");
@@ -64,7 +64,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
buildDummyItems();
if (maxWarps != warpOpenSlots.size()) {
SavageFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps");
SaberFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps");
return;
}
@@ -102,12 +102,12 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
} else {
fme.setEnteringPassword(true, warp);
fme.msg(TL.COMMAND_FWARP_PASSWORD_REQUIRED);
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, () -> {
Bukkit.getScheduler().runTaskLater(SaberFactions.plugin, () -> {
if (fme.isEnteringPassword()) {
fme.msg(TL.COMMAND_FWARP_PASSWORD_TIMEOUT);
fme.setEnteringPassword(false, "");
}
}, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20);
}, SaberFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20);
}
}
}
@@ -119,15 +119,15 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
player.teleport(fme.getFaction().getWarp(warp).getLocation());
fme.msg(TL.COMMAND_FWARP_WARPED, warp);
}
}, SavageFactions.plugin.getConfig().getLong("warmups.f-warp", 0));
}, SaberFactions.plugin.getConfig().getLong("warmups.f-warp", 0));
}
private boolean transact(FPlayer player) {
if (!SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) {
if (!SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) {
return true;
}
double cost = SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5);
double cost = SaberFactions.plugin.getConfig().getDouble("warp-cost.warp", 5);
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
return true;
@@ -143,8 +143,8 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
private ItemStack buildItem(String warp) {
ConfigurationSection warpItemSection = section.getConfigurationSection("warp-item");
if (warpItemSection == null) {
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
SaberFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
return new ItemStack(Material.AIR);
}
@@ -177,7 +177,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
string = ChatColor.translateAlternateColorCodes('&', string);
string = string.replace("{warp}", warp);
string = string.replace("{warp-protected}", faction.hasWarpPassword(warp) ? "Enabled" : "Disabled");
string = string.replace("{warp-cost}", !SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SavageFactions.plugin.getConfig().getInt("warp-cost.warp", 5)));
string = string.replace("{warp-cost}", !SaberFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SaberFactions.plugin.getConfig().getInt("warp-cost.warp", 5)));
return string;
}
@@ -187,7 +187,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
try {
dummyId = Integer.parseInt(key);
} catch (NumberFormatException exception) {
SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase());
SaberFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase());
continue;
}
@@ -199,7 +199,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
List<Integer> dummyIdSlots = section.getIntegerList("dummy-slots." + key);
for (Integer slot : dummyIdSlots) {
if (slot + 1 > guiSize || slot < 0) {
SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key);
SaberFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key);
continue;
}
dummySlots.add(slot);
@@ -212,14 +212,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
final ConfigurationSection dummySection = section.getConfigurationSection("dummy-items." + id);
if (dummySection == null) {
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
SaberFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
SaberFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
return new ItemStack(Material.AIR);
}
Material material = Material.matchMaterial(dummySection.getString("material", ""));
if (material == null) {
SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id);
SaberFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id);
return null;
}
@@ -237,7 +237,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
ItemMeta itemMeta = itemStack.getItemMeta();
if (!SavageFactions.plugin.mc17) {
if (!SaberFactions.plugin.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}