Compare commits
1 Commits
2.0.9-BETA
...
shields
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec769a56e4 |
7
pom.xml
7
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>com.massivecraft</groupId>
|
<groupId>com.massivecraft</groupId>
|
||||||
<artifactId>Factions</artifactId>
|
<artifactId>Factions</artifactId>
|
||||||
<version>1.6.9.5-U0.2.1-2.0.9-BETA</version>
|
<version>1.6.9.5-U0.2.1-2.0.6-STABLE</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>SaberFactions</name>
|
<name>SaberFactions</name>
|
||||||
@@ -387,6 +387,11 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codemc.worldguardwrapper</groupId>
|
||||||
|
<artifactId>worldguardwrapper</artifactId>
|
||||||
|
<version>1.1.6-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jagrosh</groupId>
|
<groupId>com.jagrosh</groupId>
|
||||||
<artifactId>jda-utilities-commons</artifactId>
|
<artifactId>jda-utilities-commons</artifactId>
|
||||||
|
|||||||
@@ -231,12 +231,6 @@ public class Conf {
|
|||||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||||
// Dependency check
|
// Dependency check
|
||||||
public static boolean dependencyCheck = true;
|
public static boolean dependencyCheck = true;
|
||||||
|
|
||||||
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
|
|
||||||
public static Set<Material> territoryDenySwitchMaterials = new HashSet<>();
|
|
||||||
public static Set<Material> territoryBypasssProtectedMaterials = EnumSet.noneOf(Material.class);
|
|
||||||
public static boolean allowCreeperEggingChests = true;
|
|
||||||
|
|
||||||
// Economy settings
|
// Economy settings
|
||||||
public static boolean econEnabled = false;
|
public static boolean econEnabled = false;
|
||||||
public static String econUniverseAccount = "";
|
public static String econUniverseAccount = "";
|
||||||
@@ -349,7 +343,6 @@ public class Conf {
|
|||||||
// faction-<factionId>
|
// faction-<factionId>
|
||||||
public static int defaultMaxVaults = 0;
|
public static int defaultMaxVaults = 0;
|
||||||
public static boolean disableFlightOnFactionClaimChange = true;
|
public static boolean disableFlightOnFactionClaimChange = true;
|
||||||
public static boolean sendFactionChangeMessage = true;
|
|
||||||
|
|
||||||
public static Backend backEnd = Backend.JSON;
|
public static Backend backEnd = Backend.JSON;
|
||||||
|
|
||||||
@@ -395,108 +388,11 @@ public class Conf {
|
|||||||
territoryEnemyDenyCommands.add("tpaccept");
|
territoryEnemyDenyCommands.add("tpaccept");
|
||||||
territoryEnemyDenyCommands.add("tpa");
|
territoryEnemyDenyCommands.add("tpa");
|
||||||
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ACACIA_FENCE_GATE.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BIRCH_FENCE_GATE.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_FENCE_GATE.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_FENCE_GATE.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.OAK_FENCE_GATE.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_FENCE_GATE.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ACACIA_DOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BIRCH_DOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_DOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_DOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.OAK_DOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_DOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DISPENSER.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.CHEST.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.TRAPPED_CHEST.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ACACIA_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BIRCH_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.OAK_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DROPPER.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.HOPPER.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ITEM_FRAME.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ACACIA_TRAPDOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BIRCH_TRAPDOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_TRAPDOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_TRAPDOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.OAK_TRAPDOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_TRAPDOOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.LEVER.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.COMPARATOR.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.REPEATER.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ACACIA_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BIRCH_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.DARK_OAK_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.JUNGLE_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.OAK_BUTTON.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.SPRUCE_BUTTON.parseMaterial());
|
|
||||||
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.PURPLE_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.WHITE_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.MAGENTA_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.LIGHT_BLUE_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.CYAN_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BLUE_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BROWN_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.ORANGE_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.GREEN_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.RED_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BLACK_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.GRAY_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.LIME_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.LIGHT_GRAY_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.PINK_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.YELLOW_SHULKER_BOX.parseMaterial());
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.SHULKER_BOX.parseMaterial());
|
|
||||||
|
|
||||||
// 1.14 Barrel is a container.
|
|
||||||
territoryDenySwitchMaterials.add(XMaterial.BARREL.parseMaterial());
|
|
||||||
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.GOLDEN_APPLE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.APPLE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.ENCHANTED_GOLDEN_APPLE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_BEEF.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_MUTTON.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_CHICKEN.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_COD.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_PORKCHOP.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_RABBIT.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.COOKED_SALMON.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.ENDER_PEARL.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.POTION.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.SPLASH_POTION.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CREEPER_SPAWN_EGG.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.BOW.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_HELMET.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_CHESTPLATE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_LEGGINGS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.DIAMOND_BOOTS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_HELMET.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_CHESTPLATE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_LEGGINGS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.IRON_BOOTS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_HELMET.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_CHESTPLATE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_LEGGINGS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.LEATHER_BOOTS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_HELMET.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_CHESTPLATE.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_LEGGINGS.parseMaterial());
|
|
||||||
territoryCancelAndAllowItemUseMaterial.add(XMaterial.CHAINMAIL_BOOTS.parseMaterial());
|
|
||||||
|
|
||||||
|
|
||||||
/// TODO: Consider removing this in a future release, as permissions works just fine now
|
/// TODO: Consider removing this in a future release, as permissions works just fine now
|
||||||
territoryProtectedMaterials.add(Material.BEACON);
|
territoryProtectedMaterials.add(Material.BEACON);
|
||||||
|
|
||||||
// Config is not loading if value is empty ???
|
// Config is not loading if value is empty ???
|
||||||
territoryBypassProtectedMaterials.add(Material.COOKIE);
|
territoryBypassProtectedMaterials.add(Material.COOKIE);
|
||||||
territoryBypassProtectedMaterials.add(Material.CHEST);
|
|
||||||
territoryBypassProtectedMaterials.add(Material.TRAPPED_CHEST);
|
|
||||||
|
|
||||||
|
|
||||||
territoryDenyUsageMaterials.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
territoryDenyUsageMaterials.add(XMaterial.FIRE_CHARGE.parseMaterial());
|
||||||
territoryDenyUsageMaterials.add(Material.FLINT_AND_STEEL);
|
territoryDenyUsageMaterials.add(Material.FLINT_AND_STEEL);
|
||||||
@@ -550,8 +446,6 @@ public class Conf {
|
|||||||
FactionsPlugin.getInstance().persist.save(i);
|
FactionsPlugin.getInstance().persist.save(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveSync() { FactionsPlugin.instance.persist.saveSync(i); }
|
|
||||||
|
|
||||||
public enum Backend {
|
public enum Backend {
|
||||||
JSON,
|
JSON,
|
||||||
//MYSQL, TODO add MySQL storage
|
//MYSQL, TODO add MySQL storage
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
|||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.iface.RelationParticipator;
|
import com.massivecraft.factions.iface.RelationParticipator;
|
||||||
import com.massivecraft.factions.missions.Mission;
|
import com.massivecraft.factions.missions.Mission;
|
||||||
|
import com.massivecraft.factions.shield.TimeFrame;
|
||||||
import com.massivecraft.factions.struct.BanInfo;
|
import com.massivecraft.factions.struct.BanInfo;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
@@ -441,4 +442,10 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
void paypalSet(String paypal);
|
void paypalSet(String paypal);
|
||||||
|
|
||||||
|
|
||||||
|
// shield
|
||||||
|
|
||||||
|
void setTimeFrame(TimeFrame timeFrame);
|
||||||
|
TimeFrame getTimeFrame();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ 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.*;
|
||||||
import com.massivecraft.factions.missions.MissionHandler;
|
import com.massivecraft.factions.missions.MissionHandler;
|
||||||
|
import com.massivecraft.factions.shield.TimeFrameTask;
|
||||||
import com.massivecraft.factions.shop.ShopConfig;
|
import com.massivecraft.factions.shop.ShopConfig;
|
||||||
import com.massivecraft.factions.struct.ChatMode;
|
import com.massivecraft.factions.struct.ChatMode;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
@@ -89,7 +90,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
private boolean mvdwPlaceholderAPIManager = false;
|
private boolean mvdwPlaceholderAPIManager = false;
|
||||||
private Listener[] eventsListener;
|
private Listener[] eventsListener;
|
||||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||||
private Worldguard wg;
|
|
||||||
|
|
||||||
|
|
||||||
public FactionsPlugin() {
|
public FactionsPlugin() {
|
||||||
@@ -195,7 +195,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Update their config if needed
|
//Update their config if needed
|
||||||
// Updater.updateIfNeeded(getConfig());
|
Updater.updateIfNeeded(getConfig());
|
||||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
||||||
FactionsPlugin.econ = rsp.getProvider();
|
FactionsPlugin.econ = rsp.getProvider();
|
||||||
com.massivecraft.factions.integration.Essentials.setup();
|
com.massivecraft.factions.integration.Essentials.setup();
|
||||||
@@ -231,7 +231,9 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
Econ.setup();
|
Econ.setup();
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
|
|
||||||
if (Conf.worldGuardChecking || Conf.worldGuardBuildPriority) wg = new Worldguard();
|
if (Conf.worldGuardChecking || Conf.worldGuardBuildPriority) {
|
||||||
|
Worldguard.init(this);
|
||||||
|
}
|
||||||
|
|
||||||
EngineDynmap.getInstance().init();
|
EngineDynmap.getInstance().init();
|
||||||
|
|
||||||
@@ -266,6 +268,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 30), 0L, (long) (minute * 30));
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 30), 0L, (long) (minute * 30));
|
||||||
this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L);
|
this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L);
|
||||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L);
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L);
|
||||||
|
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new TimeFrameTask(), 1200, 1200); // every 1 minute...
|
||||||
}
|
}
|
||||||
if(Conf.useDiscordSystem && !Conf.discordBotToken.equals("<token here>")) {
|
if(Conf.useDiscordSystem && !Conf.discordBotToken.equals("<token here>")) {
|
||||||
new FactionChatHandler(this);
|
new FactionChatHandler(this);
|
||||||
@@ -425,7 +428,9 @@ public class FactionsPlugin 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) {
|
||||||
Conf.saveSync();
|
// 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.
|
||||||
|
// Conf.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
@@ -737,8 +742,4 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
debug(Level.INFO, s);
|
debug(Level.INFO, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Worldguard getWg() {
|
|
||||||
return wg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ public class CmdAdmin extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (context.player == null) {
|
|
||||||
context.msg(TL.GENERIC_PLAYERONLY);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Allows admins bypass this.
|
// Allows admins bypass this.
|
||||||
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
||||||
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
||||||
|
|||||||
@@ -78,23 +78,18 @@ public class CmdDisband extends FCommand {
|
|||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast", true)) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast", true)) {
|
||||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
||||||
|
UtilFly.checkFly(context.fPlayer, 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);
|
||||||
if (!follower.canFlyAtLocation()) {
|
|
||||||
follower.setFFlying(false, false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.fPlayer.setFFlying(false, false);
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
} else {
|
} else {
|
||||||
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
|
||||||
if (!context.fPlayer.canFlyAtLocation()) {
|
|
||||||
context.fPlayer.setFFlying(false, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class CmdFly extends FCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !toFac.isSystemFaction()) {
|
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac)) {
|
||||||
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -125,6 +125,11 @@ public class CmdFly extends FCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Boolean isSystemFaction(Faction faction) {
|
||||||
|
return faction.isSafeZone() ||
|
||||||
|
faction.isWarZone() ||
|
||||||
|
faction.isWilderness();
|
||||||
|
}
|
||||||
|
|
||||||
public static void checkTaskState() {
|
public static void checkTaskState() {
|
||||||
if (flyMap.isEmpty()) {
|
if (flyMap.isEmpty()) {
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ public class CommandRequirements {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.fPlayer.isAdminBypassing()) return true;
|
|
||||||
|
|
||||||
|
|
||||||
if (!FactionsPlugin.getInstance().perm.has(context.sender, permission.node, informIfNot)) return false;
|
if (!FactionsPlugin.getInstance().perm.has(context.sender, permission.node, informIfNot)) return false;
|
||||||
|
|
||||||
// Permissable Action provided compute that before role
|
// Permissable Action provided compute that before role
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ public class CmdAlts extends FCommand {
|
|||||||
|
|
||||||
public CmdInviteAlt cmdInviteAlt = new CmdInviteAlt();
|
public CmdInviteAlt cmdInviteAlt = new CmdInviteAlt();
|
||||||
public CmdAltsList cmdAltsList = new CmdAltsList();
|
public CmdAltsList cmdAltsList = new CmdAltsList();
|
||||||
public CmdKickAlt cmdKickAlt = new CmdKickAlt();
|
|
||||||
|
|
||||||
|
|
||||||
public CmdAlts() {
|
public CmdAlts() {
|
||||||
@@ -23,7 +22,6 @@ public class CmdAlts extends FCommand {
|
|||||||
|
|
||||||
this.addSubCommand(this.cmdInviteAlt);
|
this.addSubCommand(this.cmdInviteAlt);
|
||||||
this.addSubCommand(this.cmdAltsList);
|
this.addSubCommand(this.cmdAltsList);
|
||||||
this.addSubCommand(this.cmdKickAlt);
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.ALTS)
|
this.requirements = new CommandRequirements.Builder(Permission.ALTS)
|
||||||
.playerOnly()
|
.playerOnly()
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
package com.massivecraft.factions.cmd.alts;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.cmd.CommandContext;
|
|
||||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
|
||||||
import com.massivecraft.factions.cmd.FCommand;
|
|
||||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
|
||||||
import com.massivecraft.factions.struct.Permission;
|
|
||||||
import com.massivecraft.factions.struct.Role;
|
|
||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
|
||||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
|
|
||||||
public class CmdKickAlt extends FCommand {
|
|
||||||
|
|
||||||
public CmdKickAlt(){
|
|
||||||
super();
|
|
||||||
this.aliases.add("kick");
|
|
||||||
this.requiredArgs.add("player name");
|
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.KICK)
|
|
||||||
.playerOnly()
|
|
||||||
.memberOnly()
|
|
||||||
.withAction(PermissableAction.KICK)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void perform(CommandContext context) {
|
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("f-alts.Enabled", false)) {
|
|
||||||
context.fPlayer.msg(TL.GENERIC_DISABLED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer toKick = context.argIsSet(0) ? context.argAsBestFPlayerMatch(0) : null;
|
|
||||||
if (toKick == null) {
|
|
||||||
context.msg(TL.COMMAND_ALTKICK_NOTMEMBER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.fPlayer == toKick) {
|
|
||||||
context.msg(TL.COMMAND_KICK_SELF);
|
|
||||||
context.msg(TL.GENERIC_YOUMAYWANT.toString() + FactionsPlugin.instance.cmdBase.cmdLeave.getUsageTemplate(context));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Faction toKickFaction = toKick.getFaction();
|
|
||||||
|
|
||||||
if (toKickFaction.isWilderness()) {
|
|
||||||
context.sender.sendMessage(TL.COMMAND_KICK_NONE.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// players with admin-level "disband" permission can bypass these
|
|
||||||
// requirements
|
|
||||||
if (!Permission.KICK_ANY.has(context.sender)) {
|
|
||||||
if (toKickFaction != context.faction) {
|
|
||||||
context.msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(context.fPlayer, true), context.faction.describeTo(context.fPlayer));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!toKick.isAlt()) {
|
|
||||||
context.msg(TL.COMMAND_ALTKICK_NOTALT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
|
|
||||||
context.msg(TL.COMMAND_KICK_NEGATIVEPOWER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.KICK);
|
|
||||||
// This statement allows us to check if they've specifically denied it,
|
|
||||||
// or default to
|
|
||||||
// the old setting of allowing moderators to kick
|
|
||||||
if (access != Access.ALLOW && !context.assertMinRole(Role.MODERATOR)) {
|
|
||||||
context.msg(TL.GENERIC_NOPERMISSION, "kick");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this
|
|
||||||
// command has a cost set, make sure they can pay
|
|
||||||
if (!context.canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// trigger the leave event (cancellable) [reason:kicked]
|
|
||||||
FPlayerLeaveEvent event = new FPlayerLeaveEvent(toKick, toKick.getFaction(), FPlayerLeaveEvent.PlayerLeaveReason.KICKED);
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// then make 'em pay (if applicable)
|
|
||||||
if (!context.payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
toKickFaction.msg(TL.COMMAND_KICK_FACTION, context.fPlayer.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
|
|
||||||
|
|
||||||
toKick.msg(TL.COMMAND_KICK_KICKED, context.fPlayer.describeTo(toKick, true), toKickFaction.describeTo(toKick));
|
|
||||||
|
|
||||||
if (toKickFaction != context.faction) {
|
|
||||||
context.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(context.fPlayer), toKickFaction.describeTo(context.fPlayer));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Conf.logFactionKick) {
|
|
||||||
FactionsPlugin.instance.log((context.sender instanceof ConsoleCommandSender ? "A console command" : context.fPlayer.getName()) + " kicked " + toKick.getName() + " from the faction: "
|
|
||||||
+ toKickFaction.getTag());
|
|
||||||
}
|
|
||||||
// SHOULD NOT BE POSSIBLE BUT KEPT INCASE
|
|
||||||
if (toKick.getRole() == Role.LEADER) {
|
|
||||||
toKickFaction.promoteNewLeader();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
toKickFaction.removeAltPlayer(toKick);
|
|
||||||
toKickFaction.deinvite(toKick);
|
|
||||||
toKick.resetFactionData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TL getUsageTranslation() {
|
|
||||||
return TL.COMMAND_ALTKICK_DESCRIPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -54,9 +54,7 @@ public class CmdUnclaim extends FCommand {
|
|||||||
|
|
||||||
if (radius == 1) {
|
if (radius == 1) {
|
||||||
// single chunk
|
// single chunk
|
||||||
boolean didUnClaim = unClaim(new FLocation(context.player), context);
|
unClaim(new FLocation(context.player), context);
|
||||||
if (didUnClaim && !context.fPlayer.canFlyAtLocation())
|
|
||||||
context.fPlayer.setFFlying(false, false);
|
|
||||||
} else {
|
} else {
|
||||||
// radius claim
|
// radius claim
|
||||||
if (!Permission.CLAIM_RADIUS.has(context.sender, false)) {
|
if (!Permission.CLAIM_RADIUS.has(context.sender, false)) {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class CmdTnt extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemStack tnt = new ItemStack(Material.TNT, amount);
|
ItemStack tnt = new ItemStack(Material.TNT, amount);
|
||||||
if (context.faction.getTnt() + amount > context.faction.getTntBankLimit()) {
|
if (context.faction.getTnt() + amount > FactionsPlugin.instance.getConfig().getInt("ftnt.Bank-Limit")) {
|
||||||
context.msg(TL.COMMAND_TNT_EXCEEDLIMIT);
|
context.msg(TL.COMMAND_TNT_EXCEEDLIMIT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ public class CmdTnt extends FCommand {
|
|||||||
|
|
||||||
context.faction.addTnt(amount);
|
context.faction.addTnt(amount);
|
||||||
context.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS);
|
context.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS);
|
||||||
context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + "")));
|
context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.fPlayer.getFaction().getTnt() + "")));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ public class CmdTnt extends FCommand {
|
|||||||
context.msg(TL.GENERIC_ARGS_TOOFEW);
|
context.msg(TL.GENERIC_ARGS_TOOFEW);
|
||||||
context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION);
|
context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION);
|
||||||
}
|
}
|
||||||
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + ""));
|
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,288 +3,137 @@ package com.massivecraft.factions.integration;
|
|||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.domains.Association;
|
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
import com.sk89q.worldguard.protection.association.Associables;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
|
||||||
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.Bukkit;
|
|
||||||
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.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
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 static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WorldGuard Permission Checking.
|
* Worldguard Region Checking
|
||||||
* https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/java/com/elmakers/mine/bukkit/protection/WorldGuardAPI.java
|
* Author: Spathizilla
|
||||||
* Original Authors: NathonWolf, killme
|
|
||||||
* Converted & Adapted: Savag3life
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Worldguard {
|
public class Worldguard {
|
||||||
|
|
||||||
private Object worldGuard;
|
private static WorldGuardPlugin wg;
|
||||||
private WorldGuardPlugin worldGuardPlugin;
|
private static boolean enabled = false;
|
||||||
private Object regionContainer;
|
|
||||||
private Method regionContainerGetMethod;
|
|
||||||
private Method createQueryMethod;
|
|
||||||
private Method regionQueryTestStateMethod;
|
|
||||||
private Method locationAdaptMethod;
|
|
||||||
private Method worldAdaptMethod;
|
|
||||||
private Method regionManagerGetMethod;
|
|
||||||
private Constructor<?> vectorConstructor;
|
|
||||||
private Method vectorConstructorAsAMethodBecauseWhyNot;
|
|
||||||
private StateFlag buildFlag;
|
|
||||||
private StateFlag breakFlag;
|
|
||||||
private boolean initialized = false;
|
|
||||||
|
|
||||||
private static Worldguard instance;
|
public static void init(Plugin plugin) {
|
||||||
|
Plugin wgplug = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||||
public Worldguard() {
|
if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) {
|
||||||
instance = this;
|
enabled = false;
|
||||||
|
wg = null;
|
||||||
Plugin p = Bukkit.getPluginManager().getPlugin("WorldGuard");
|
FactionsPlugin.getInstance().log("Could not hook to WorldGuard. WorldGuard checks are disabled.");
|
||||||
|
|
||||||
if (p == null) {
|
|
||||||
FactionsPlugin.instance.log("Could not find WorldGuard! Support will not be added.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (p instanceof WorldGuardPlugin) {
|
|
||||||
worldGuardPlugin = (WorldGuardPlugin) p;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Class<?> worldGuardClass = Class.forName("com.sk89q.worldguard.WorldGuard");
|
|
||||||
Method getInstanceMethod = worldGuardClass.getMethod("getInstance");
|
|
||||||
worldGuard = getInstanceMethod.invoke(null);
|
|
||||||
FactionsPlugin.instance.log("Found WorldGuard 7+");
|
|
||||||
} catch (Exception ex) { FactionsPlugin.instance.log("Found WorldGuard <7"); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return worldGuardPlugin != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Worldguard getInstance() { return instance; }
|
|
||||||
|
|
||||||
protected RegionAssociable getAssociable(Player player) {
|
|
||||||
RegionAssociable associable;
|
|
||||||
if (player == null) {
|
|
||||||
associable = Associables.constant(Association.NON_MEMBER);
|
|
||||||
} else {
|
} else {
|
||||||
associable = worldGuardPlugin.wrapPlayer(player);
|
wg = (WorldGuardPlugin) wgplug;
|
||||||
}
|
enabled = true;
|
||||||
|
FactionsPlugin.getInstance().log("Successfully hooked to WorldGuard.");
|
||||||
return associable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Credits to the people listed above for using reflections to load WorldGuard 6.0 & 7.0 in 1 class!
|
|
||||||
*/
|
|
||||||
private void initialize() {
|
|
||||||
if (!initialized) {
|
|
||||||
initialized = true;
|
|
||||||
if (worldGuard != null) {
|
|
||||||
try {
|
|
||||||
Method getPlatFormMethod = worldGuard.getClass().getMethod("getPlatform");
|
|
||||||
Object platform = getPlatFormMethod.invoke(worldGuard);
|
|
||||||
Method getRegionContainerMethod = platform.getClass().getMethod("getRegionContainer");
|
|
||||||
regionContainer = getRegionContainerMethod.invoke(platform);
|
|
||||||
createQueryMethod = regionContainer.getClass().getMethod("createQuery");
|
|
||||||
Class<?> worldEditLocationClass = Class.forName("com.sk89q.worldedit.util.Location");
|
|
||||||
Class<?> worldEditWorldClass = Class.forName("com.sk89q.worldedit.world.World");
|
|
||||||
Class<?> worldEditAdapterClass = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter");
|
|
||||||
worldAdaptMethod = worldEditAdapterClass.getMethod("adapt", World.class);
|
|
||||||
locationAdaptMethod = worldEditAdapterClass.getMethod("adapt", Location.class);
|
|
||||||
regionContainerGetMethod = regionContainer.getClass().getMethod("get", worldEditWorldClass);
|
|
||||||
Class<?> regionQueryClass = Class.forName("com.sk89q.worldguard.protection.regions.RegionQuery");
|
|
||||||
regionQueryTestStateMethod = regionQueryClass.getMethod("testState", worldEditLocationClass, RegionAssociable.class, StateFlag[].class);
|
|
||||||
|
|
||||||
Class<?> flagsClass = Class.forName("com.sk89q.worldguard.protection.flags.Flags");
|
|
||||||
|
|
||||||
buildFlag = (StateFlag) flagsClass.getField("BUILD").get(null);
|
|
||||||
breakFlag = (StateFlag) flagsClass.getField("BREAK").get(null);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("We failed to load some part of World Guard. Support will be removed!");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
regionContainer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
regionContainer = worldGuardPlugin.getRegionContainer();
|
|
||||||
try {
|
|
||||||
createQueryMethod = regionContainer.getClass().getMethod("createQuery");
|
|
||||||
regionContainerGetMethod = regionContainer.getClass().getMethod("get", World.class);
|
|
||||||
Class<?> regionQueryClass = Class.forName("com.sk89q.worldguard.bukkit.RegionQuery");
|
|
||||||
regionQueryTestStateMethod = regionQueryClass.getMethod("testState", Location.class, RegionAssociable.class, StateFlag[].class);
|
|
||||||
|
|
||||||
Class<?> flagsClass = Class.forName("com.sk89q.worldguard.protection.flags.DefaultFlag");
|
|
||||||
|
|
||||||
buildFlag = (StateFlag) flagsClass.getField("BUILD").get(null);
|
|
||||||
breakFlag = (StateFlag) flagsClass.getField("BREAK").get(null);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("We failed to load some part of World Guard. Support will be removed!");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
regionContainer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Class<?> vectorClass = Class.forName("com.sk89q.worldedit.Vector");
|
|
||||||
vectorConstructor = vectorClass.getConstructor(Double.TYPE, Double.TYPE, Double.TYPE);
|
|
||||||
regionManagerGetMethod = RegionManager.class.getMethod("getApplicableRegions", vectorClass);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
try {
|
|
||||||
Class<?> vectorClass = Class.forName("com.sk89q.worldedit.math.BlockVector3");
|
|
||||||
vectorConstructorAsAMethodBecauseWhyNot = vectorClass.getMethod("at", Double.TYPE, Double.TYPE, Double.TYPE);
|
|
||||||
regionManagerGetMethod = RegionManager.class.getMethod("getApplicableRegions", vectorClass);
|
|
||||||
} catch (Exception sodonewiththis) {
|
|
||||||
FactionsPlugin.instance.log("We failed to load Vector Classes from WorldGuard! Support will be removed!");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
regionContainer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private RegionManager getRegionManager(World world) {
|
public static boolean isEnabled() {
|
||||||
initialize();
|
return enabled;
|
||||||
if (regionContainer == null || regionContainerGetMethod == null) return null;
|
}
|
||||||
RegionManager regionManager = null;
|
|
||||||
|
// PVP Flag check
|
||||||
|
// Returns:
|
||||||
|
// True: PVP is allowed
|
||||||
|
// False: PVP is disallowed
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static boolean isPVP(Player player) {
|
||||||
|
if (!enabled) {
|
||||||
|
// No WG hooks so we'll always bypass this check.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location loc = player.getLocation();
|
||||||
|
World world = loc.getWorld();
|
||||||
|
Vector pt = toVector(loc);
|
||||||
|
|
||||||
|
RegionManager regionManager = wg.getRegionManager(world);
|
||||||
|
ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
|
||||||
|
return set.allows(DefaultFlag.PVP);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if player can build at location by worldguards rules.
|
||||||
|
// Returns:
|
||||||
|
// True: Player can build in the region.
|
||||||
|
// False: Player can not build in the region.
|
||||||
|
public static boolean playerCanBuild(Player player, Location loc) {
|
||||||
|
if (!enabled) {
|
||||||
|
// No WG hooks so we'll always bypass this check.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
World world = loc.getWorld();
|
||||||
|
Vector pt = toVector(loc);
|
||||||
|
|
||||||
|
return wg.getRegionManager(world).getApplicableRegions(pt).size() > 0 && wg.canBuild(player, loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for Regions in chunk the chunk
|
||||||
|
// Returns:
|
||||||
|
// True: Regions found within chunk
|
||||||
|
// False: No regions found within chunk
|
||||||
|
|
||||||
|
public static boolean checkForRegionsInChunk(FLocation floc) {
|
||||||
|
Chunk chunk = floc.getWorld().getChunkAt((int) floc.getX(), (int) floc.getZ());
|
||||||
|
|
||||||
|
return checkForRegionsInChunk(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean checkForRegionsInChunk(Location loc) {
|
||||||
|
Chunk chunk = loc.getWorld().getChunkAt(loc);
|
||||||
|
|
||||||
|
return checkForRegionsInChunk(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean checkForRegionsInChunk(Chunk chunk) {
|
||||||
|
if (!enabled) {
|
||||||
|
// No WG hooks so we'll always bypass this check.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
World world = chunk.getWorld();
|
||||||
|
int minChunkX = chunk.getX() << 4;
|
||||||
|
int minChunkZ = chunk.getZ() << 4;
|
||||||
|
int maxChunkX = minChunkX + 15;
|
||||||
|
int maxChunkZ = minChunkZ + 15;
|
||||||
|
|
||||||
|
int worldHeight = world.getMaxHeight(); // Allow for heights other than default
|
||||||
|
|
||||||
|
BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ);
|
||||||
|
BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ);
|
||||||
|
|
||||||
|
RegionManager regionManager = wg.getRegionManager(world);
|
||||||
|
ProtectedCuboidRegion region = new ProtectedCuboidRegion("wgfactionoverlapcheck", minChunk, maxChunk);
|
||||||
|
Map<String, ProtectedRegion> allregions = regionManager.getRegions();
|
||||||
|
Collection<ProtectedRegion> allregionslist = new ArrayList<>(allregions.values());
|
||||||
|
List<ProtectedRegion> overlaps;
|
||||||
|
boolean foundregions = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (worldAdaptMethod != null) {
|
overlaps = region.getIntersectingRegions(allregionslist);
|
||||||
Object worldEditWorld = worldAdaptMethod.invoke(null, world);
|
foundregions = overlaps != null && !overlaps.isEmpty();
|
||||||
regionManager = (RegionManager)regionContainerGetMethod.invoke(regionContainer, worldEditWorld);
|
} catch (Exception e) {
|
||||||
} else {
|
e.printStackTrace();
|
||||||
regionManager = (RegionManager)regionContainerGetMethod.invoke(regionContainer, world);
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard RegionManager");
|
|
||||||
}
|
}
|
||||||
return regionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ApplicableRegionSet getRegionSet(Location location) {
|
return foundregions;
|
||||||
RegionManager regionManager = getRegionManager(location.getWorld());
|
|
||||||
if (regionManager == null) return null;
|
|
||||||
try {
|
|
||||||
Object vector = vectorConstructorAsAMethodBecauseWhyNot == null
|
|
||||||
? vectorConstructor.newInstance(location.getX(), location.getY(), location.getZ())
|
|
||||||
: vectorConstructorAsAMethodBecauseWhyNot.invoke(null, location.getX(), location.getY(), location.getZ());
|
|
||||||
return (ApplicableRegionSet)regionManagerGetMethod.invoke(regionManager, vector);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("An error occurred looking up a WorldGuard ApplicableRegionSet");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to check WorldGuard to see if a Player has permission to place a block.
|
|
||||||
* @param player player in question.
|
|
||||||
* @param location Location of block placed.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean hasBuildPermission(Player player, Location location) {
|
|
||||||
initialize();
|
|
||||||
if (createQueryMethod != null && regionContainer != null) {
|
|
||||||
try {
|
|
||||||
Object query = createQueryMethod.invoke(regionContainer);
|
|
||||||
if (locationAdaptMethod != null) {
|
|
||||||
Object loc = locationAdaptMethod.invoke(null, location);
|
|
||||||
return (boolean)regionQueryTestStateMethod.invoke(query, loc, getAssociable(player), new StateFlag[]{buildFlag});
|
|
||||||
} else return (boolean)regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{buildFlag});
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to check WorldGuard to see if a player has permission to break a block.
|
|
||||||
* @param player player in question.
|
|
||||||
* @param location Location of block broken.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean hasBreakPermission(Player player, Location location) {
|
|
||||||
initialize();
|
|
||||||
if (createQueryMethod != null && regionContainer != null) {
|
|
||||||
try {
|
|
||||||
Object query = createQueryMethod.invoke(regionContainer);
|
|
||||||
if (locationAdaptMethod != null) {
|
|
||||||
Object loc = locationAdaptMethod.invoke(null, location);
|
|
||||||
return (boolean) regionQueryTestStateMethod.invoke(query, loc, getAssociable(player), new StateFlag[]{breakFlag});
|
|
||||||
} else return (boolean) regionQueryTestStateMethod.invoke(query, location, getAssociable(player), new StateFlag[]{breakFlag});
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkForRegionsInChunk(FLocation floc) { return checkForRegionsInChunk(floc.getChunk()); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for checking if regions are located in a chunk
|
|
||||||
* @param chunk Chunk in question.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean checkForRegionsInChunk(Chunk chunk) {
|
|
||||||
initialize();
|
|
||||||
if (createQueryMethod != null && regionContainer != null) {
|
|
||||||
try {
|
|
||||||
World world = chunk.getWorld();
|
|
||||||
int minChunkX = chunk.getX() << 4;
|
|
||||||
int minChunkZ = chunk.getZ() << 4;
|
|
||||||
int maxChunkX = minChunkX + 15;
|
|
||||||
int maxChunkZ = minChunkZ + 15;
|
|
||||||
|
|
||||||
int worldHeight = world.getMaxHeight(); // Allow for heights other than default
|
|
||||||
|
|
||||||
BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ);
|
|
||||||
BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ);
|
|
||||||
|
|
||||||
ProtectedCuboidRegion region = new ProtectedCuboidRegion("wgfactionoverlapcheck", minChunk, maxChunk);
|
|
||||||
|
|
||||||
Collection<ProtectedRegion> allregionslist = new ArrayList<>(getRegionManager(world).getRegions().values());
|
|
||||||
List<ProtectedRegion> overlaps = region.getIntersectingRegions(allregionslist);
|
|
||||||
|
|
||||||
return overlaps != null && !overlaps.isEmpty();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
FactionsPlugin.instance.log("An error occurred querying WorldGuard! Report this issue to SF Developers!");
|
|
||||||
FactionsPlugin.instance.log("WorldGuard 7.0.0 support is currently in BETA. Please be careful!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* General check for WorldGuard region @ location.
|
|
||||||
* @param player player in question.
|
|
||||||
* @param location Location of block broken.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean playerCanBuild(Player player, Location location) {
|
|
||||||
return hasBuildPermission(player, location) && hasBreakPermission(player, location);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ import com.massivecraft.factions.integration.Worldguard;
|
|||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.ItemBuilder;
|
|
||||||
import com.massivecraft.factions.util.Particles.ParticleEffect;
|
import com.massivecraft.factions.util.Particles.ParticleEffect;
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
@@ -26,7 +25,6 @@ import org.bukkit.event.block.*;
|
|||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
@@ -42,36 +40,54 @@ public class FactionsBlockListener implements Listener {
|
|||||||
private HashMap<String, Boolean> bannerCooldownMap = new HashMap<>();
|
private HashMap<String, Boolean> bannerCooldownMap = new HashMap<>();
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
if (Conf.playersWhoBypassAllProtection.contains(player.getName())) return true;
|
if (Conf.playersWhoBypassAllProtection.contains(name))
|
||||||
|
return true;
|
||||||
|
|
||||||
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
|
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
|
||||||
if (me.isAdminBypassing()) return true;
|
Faction myFaction = me.getFaction();
|
||||||
|
if (me.isAdminBypassing())
|
||||||
|
return true;
|
||||||
|
|
||||||
FLocation loc = new FLocation(location);
|
FLocation loc = new FLocation(location);
|
||||||
Faction otherFaction = Board.getInstance().getFactionAt(loc);
|
Faction otherFaction = Board.getInstance().getFactionAt(loc);
|
||||||
Faction myFaction = me.getFaction();
|
|
||||||
|
|
||||||
if (otherFaction.isWilderness()) {
|
if (otherFaction.isWilderness()) {
|
||||||
if (Conf.worldGuardBuildPriority && Worldguard.getInstance().playerCanBuild(player, location)) return true;
|
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location))
|
||||||
if (location.getWorld() != null) {
|
return true;
|
||||||
if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName()))
|
|
||||||
return true;
|
if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName()))
|
||||||
}
|
return true; // This is not faction territory. Use whatever you like here.
|
||||||
if (!justCheck) me.msg(TL.ACTION_DENIED_WILDERNESS, action);
|
|
||||||
|
if (!justCheck)
|
||||||
|
me.msg("<b>You can't " + action + " in the wilderness.");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (otherFaction.isSafeZone()) {
|
} else if (otherFaction.isSafeZone()) {
|
||||||
if (Conf.worldGuardBuildPriority && Worldguard.getInstance().playerCanBuild(player, location)) return true;
|
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location))
|
||||||
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player)) return true;
|
return true;
|
||||||
if (!justCheck) me.msg(TL.ACTION_DENIED_SAFEZONE, action);
|
|
||||||
|
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!justCheck)
|
||||||
|
me.msg("<b>You can't " + action + " in a safe zone.");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (otherFaction.isWarZone()) {
|
} else if (otherFaction.isWarZone()) {
|
||||||
if (Conf.worldGuardBuildPriority && Worldguard.getInstance().playerCanBuild(player, location)) return true;
|
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location))
|
||||||
if (!Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player)) return true;
|
return true;
|
||||||
if (!justCheck) me.msg(TL.ACTION_DENIED_WARZONE, action);
|
|
||||||
|
if (!Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!justCheck)
|
||||||
|
me.msg("<b>You can't " + action + " in a war zone.");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (!otherFaction.getId().equals(myFaction.getId())) { // If the faction target is not my own
|
} else if (!otherFaction.getId().equals(myFaction.getId())) { // If the faction target is not my own
|
||||||
if (FactionsPlugin.instance.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
|
||||||
return true;
|
return true;
|
||||||
// Get faction pain build access relation to me
|
// Get faction pain build access relation to me
|
||||||
boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
|
boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
|
||||||
@@ -80,6 +96,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
|
boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
|
||||||
return CheckActionState(myFaction, loc, me, PermissableAction.fromString(action), pain);
|
return CheckActionState(myFaction, loc, me, PermissableAction.fromString(action), pain);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something failed prevent build
|
// Something failed prevent build
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -93,17 +110,16 @@ public class FactionsBlockListener implements Listener {
|
|||||||
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY.toString().replace("{owners}", myFaction.getOwnerListString(loc)));
|
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY.toString().replace("{owners}", myFaction.getOwnerListString(loc)));
|
||||||
if (shouldHurt) {
|
if (shouldHurt) {
|
||||||
player.damage(Conf.actionDeniedPainAmount);
|
player.damage(Conf.actionDeniedPainAmount);
|
||||||
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
if ((Board.getInstance().getFactionAt(loc).getTag(myFaction)) != null)
|
||||||
|
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (!landOwned && access == Access.DENY) { // If land is not owned but access is set to DENY anyway
|
} else if (!landOwned && access == Access.DENY) { // If land is not owned but access is set to DENY anyway
|
||||||
if (shouldHurt) {
|
if (shouldHurt) {
|
||||||
player.damage(Conf.actionDeniedPainAmount);
|
player.damage(Conf.actionDeniedPainAmount);
|
||||||
if ((Board.getInstance().getFactionAt(loc).getTag(myFaction)) != null)
|
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||||
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
|
||||||
}
|
}
|
||||||
if (myFaction.getTag(me.getFaction()) != null && action != null)
|
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
|
||||||
return false;
|
return false;
|
||||||
} else if (access == Access.ALLOW) return true;
|
} else if (access == Access.ALLOW) return true;
|
||||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||||
@@ -126,17 +142,21 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
@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()) return;
|
if (!event.canBuild()) {
|
||||||
|
return;
|
||||||
// special case for flint&steel, which should only be prevented by DenyUsage list
|
}
|
||||||
if (event.getBlockPlaced().getType() == Material.FIRE) return;
|
|
||||||
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
|
||||||
|
|
||||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), !isSpawner ? "build" : "mine spawners", false)) {
|
// special case for flint&steel, which should only be prevented by DenyUsage list
|
||||||
|
if (event.getBlockPlaced().getType() == Material.FIRE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isSpawner) {
|
|
||||||
|
if (event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial())) {
|
||||||
if (Conf.spawnerLock) {
|
if (Conf.spawnerLock) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
||||||
@@ -146,12 +166,17 @@ 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) return;
|
if (!Conf.handleExploitLiquidFlow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getBlock().isLiquid()) {
|
if (event.getBlock().isLiquid()) {
|
||||||
if (event.getToBlock().isEmpty()) {
|
if (event.getToBlock().isEmpty()) {
|
||||||
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||||
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
||||||
if (from == to) return;
|
if (from == to) {
|
||||||
|
// not concerned with inter-faction events
|
||||||
|
return;
|
||||||
|
}
|
||||||
// from faction != to faction
|
// from faction != to faction
|
||||||
if (to.isNormal()) {
|
if (to.isNormal()) {
|
||||||
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
||||||
@@ -172,27 +197,31 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
@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) return;
|
if (!Conf.pistonProtectionThroughDenyBuild) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||||
|
|
||||||
// target end-of-the-line empty (air) block which is being pushed into, including if piston itself would extend into air
|
// target end-of-the-line empty (air) block which is being pushed into, including if piston itself would extend into air
|
||||||
Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1);
|
Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1);
|
||||||
|
|
||||||
// if potentially pushing into air/water/lava in another territory, we need to check it out
|
// if potentially pushing into air/water/lava in another territory, we need to check it out
|
||||||
if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && !canPistonMoveBlock(pistonFaction, targetBlock.getLocation()))
|
if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && !canPistonMoveBlock(pistonFaction, targetBlock.getLocation())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* note that I originally was testing the territory of each affected block, but since I found that pistons can only push
|
||||||
|
* up to 12 blocks and the width of any territory is 16 blocks, it should be safe (and much more lightweight) to test
|
||||||
|
* only the 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) {
|
||||||
|
ItemStack vault = FactionsPlugin.getInstance().createItem(Material.CHEST, 1, (short) 0, FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fvault.Item.Name")), FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fvault.Item.Lore")));
|
||||||
ItemStack vault = new ItemBuilder(Material.CHEST)
|
|
||||||
.amount(1).name(FactionsPlugin.instance.getConfig().getString("fvault.Item.Name"))
|
|
||||||
.lore(FactionsPlugin.instance.getConfig().getStringList("fvault.Item.Lore"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
if (e.getItemInHand().isSimilar(vault)) {
|
if (e.getItemInHand().isSimilar(vault)) {
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
if (fme.getFaction().getVault() != null) {
|
if (fme.getFaction().getVault() != null) {
|
||||||
@@ -215,8 +244,10 @@ public class FactionsBlockListener implements Listener {
|
|||||||
if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ()) {
|
if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Material blockMaterial = blockLoc.getBlock().getType();
|
Material blockMaterial = blockLoc.getBlock().getType();
|
||||||
if (blockMaterial == Material.CHEST || (FactionsPlugin.instance.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) {
|
|
||||||
|
if (blockMaterial == Material.CHEST || (FactionsPlugin.getInstance().getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
fme.msg(TL.COMMAND_GETVAULT_CHESTNEAR);
|
fme.msg(TL.COMMAND_GETVAULT_CHESTNEAR);
|
||||||
return;
|
return;
|
||||||
@@ -224,6 +255,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fme.msg(TL.COMMAND_GETVAULT_SUCCESS);
|
fme.msg(TL.COMMAND_GETVAULT_SUCCESS);
|
||||||
fme.getFaction().setVault(e.getBlockPlaced().getLocation());
|
fme.getFaction().setVault(e.getBlockPlaced().getLocation());
|
||||||
|
|
||||||
@@ -231,12 +263,21 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler (ignoreCancelled = true)
|
||||||
public void onHopperPlace(BlockPlaceEvent e) {
|
public void onHopperPlace(BlockPlaceEvent e) {
|
||||||
if (e.getItemInHand().getType() != Material.HOPPER && !FactionsPlugin.instance.getConfig().getBoolean("fvault.No-Hoppers-near-vault")) return;
|
if (e.getItemInHand().getType() != Material.HOPPER || !FactionsPlugin.getInstance().getConfig().getBoolean("fvault.No-Hoppers-near-vault")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Faction factionAt = Board.getInstance().getFactionAt(new FLocation(e.getBlockPlaced().getLocation()));
|
Faction factionAt = Board.getInstance().getFactionAt(new FLocation(e.getBlockPlaced().getLocation()));
|
||||||
if (factionAt.isWilderness() || factionAt.getVault() == null) return;
|
|
||||||
|
if (factionAt.isWilderness() || factionAt.getVault() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
|
|
||||||
Block start = e.getBlockPlaced();
|
Block start = e.getBlockPlaced();
|
||||||
int radius = 1;
|
int radius = 1;
|
||||||
for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++) {
|
for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++) {
|
||||||
@@ -247,7 +288,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockLoc.getBlock().getType() == XMaterial.CHEST.parseMaterial()) {
|
if (blockLoc.getBlock().getType() == Material.CHEST) {
|
||||||
if (factionAt.getVault().equals(blockLoc)) {
|
if (factionAt.getVault().equals(blockLoc)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
fme.msg(TL.COMMAND_VAULT_NO_HOPPER);
|
fme.msg(TL.COMMAND_VAULT_NO_HOPPER);
|
||||||
@@ -263,21 +304,32 @@ 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) return;
|
if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Location targetLoc = event.getRetractLocation();
|
if (event.getBlocks().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location targetLoc = event.getBlocks().get(0).getLocation();
|
||||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(targetLoc));
|
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(targetLoc));
|
||||||
|
|
||||||
// Check if the piston is moving in a faction's territory. This disables pistons entirely in faction territory.
|
// Check if the piston is moving in a faction's territory. This disables pistons entirely in faction territory.
|
||||||
if (otherFaction.isNormal() && FactionsPlugin.instance.getConfig().getBoolean("disable-pistons-in-territory", false)) {
|
if (otherFaction.isNormal() && FactionsPlugin.getInstance().getConfig().getBoolean("disable-pistons-in-territory", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if potentially retracted block is just air/water/lava, no worries
|
// if potentially retracted block is just air/water/lava, no worries
|
||||||
if (targetLoc.getBlock().isEmpty() || targetLoc.getBlock().isLiquid()) return;
|
if (targetLoc.getBlock().isEmpty() || targetLoc.getBlock().isLiquid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||||
if (!canPistonMoveBlock(pistonFaction, targetLoc)) event.setCancelled(true);
|
|
||||||
|
if (!canPistonMoveBlock(pistonFaction, targetLoc)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -297,13 +349,16 @@ public class FactionsBlockListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBannerPlace(BlockPlaceEvent e) {
|
public void onBannerPlace(BlockPlaceEvent e) {
|
||||||
if (FactionsPlugin.getInstance().mc17) return;
|
if (FactionsPlugin.getInstance().mc17) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.getItemInHand().getType().name().contains("BANNER")) {
|
if (e.getItemInHand().getType().name().contains("BANNER")) {
|
||||||
ItemStack bannerInHand = e.getItemInHand();
|
ItemStack bannerInHand = e.getItemInHand();
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
ItemStack warBanner = fme.getFaction().getBanner();
|
ItemStack warBanner = fme.getFaction().getBanner();
|
||||||
if (warBanner == null) return;
|
if (warBanner == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ItemMeta warmeta = warBanner.getItemMeta();
|
ItemMeta warmeta = warBanner.getItemMeta();
|
||||||
warmeta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fbanners.Item.Name")));
|
warmeta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fbanners.Item.Name")));
|
||||||
warmeta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Item.Lore")));
|
warmeta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Item.Lore")));
|
||||||
@@ -385,8 +440,9 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
Location location = event.getBlock().getLocation();
|
Location location = event.getBlock().getLocation();
|
||||||
@@ -394,10 +450,14 @@ public class FactionsBlockListener implements Listener {
|
|||||||
// only notify every 10 seconds
|
// only notify every 10 seconds
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
boolean justCheck = fPlayer.getLastFrostwalkerMessage() + 10000 > System.currentTimeMillis();
|
boolean justCheck = fPlayer.getLastFrostwalkerMessage() + 10000 > System.currentTimeMillis();
|
||||||
if (!justCheck) fPlayer.setLastFrostwalkerMessage();
|
if (!justCheck) {
|
||||||
|
fPlayer.setLastFrostwalkerMessage();
|
||||||
|
}
|
||||||
|
|
||||||
// Check if they have build permissions here. If not, block this from happening.
|
// Check if they have build permissions here. If not, block this from happening.
|
||||||
if (!playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) event.setCancelled(true);
|
if (!playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -446,36 +506,41 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean canPistonMoveBlock(Faction pistonFaction, Location target) {
|
private boolean canPistonMoveBlock(Faction pistonFaction, Location target) {
|
||||||
|
|
||||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(target));
|
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(target));
|
||||||
|
|
||||||
if (pistonFaction == otherFaction) return true;
|
if (pistonFaction == otherFaction)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (otherFaction.isWilderness())
|
if (otherFaction.isWilderness())
|
||||||
return !Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName());
|
return !Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName());
|
||||||
else if (otherFaction.isSafeZone()) return !Conf.safeZoneDenyBuild;
|
|
||||||
else if (otherFaction.isWarZone()) return !Conf.warZoneDenyBuild;
|
else if (otherFaction.isSafeZone())
|
||||||
|
return !Conf.safeZoneDenyBuild;
|
||||||
|
|
||||||
|
else if (otherFaction.isWarZone())
|
||||||
|
return !Conf.warZoneDenyBuild;
|
||||||
|
|
||||||
Relation rel = pistonFaction.getRelationTo(otherFaction);
|
Relation rel = pistonFaction.getRelationTo(otherFaction);
|
||||||
|
|
||||||
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) {
|
||||||
boolean isSpawner = event.getBlock().getType() == XMaterial.SPAWNER.parseMaterial();
|
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), !isSpawner ? "destroy" : "mine spawners", false)) {
|
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
if (!fme.hasFaction())
|
||||||
|
return;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
if (event.getBlock().getType() == XMaterial.SPAWNER.parseMaterial()) {
|
||||||
public void FrameRemove(HangingBreakByEntityEvent event) {
|
if (!fme.isAdminBypassing()) {
|
||||||
if (event.getRemover() == null) return;
|
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
|
||||||
if ((event.getRemover() instanceof Player)) {
|
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||||
if (event.getEntity().getType().equals(EntityType.ITEM_FRAME)) {
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
|
||||||
Player p = (Player) event.getRemover();
|
|
||||||
if (!playerCanBuildDestroyBlock(p, event.getEntity().getLocation(), "destroy", true)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,9 +551,11 @@ public class FactionsBlockListener implements Listener {
|
|||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true)) {
|
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true)) {
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
|
||||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation()));
|
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation()));
|
||||||
me.msg(TL.ACTION_DENIED_OTHER, otherFaction.getTag(), "trample crops");
|
Faction myFaction = me.getFaction();
|
||||||
|
|
||||||
|
me.msg("<b>You can't jump on farmland in the territory of " + otherFaction.getTag(myFaction));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ public class FactionsEntityListener implements Listener {
|
|||||||
// this should trigger if the attacker shootin the arrow is a mob
|
// this should trigger if the attacker shootin the arrow is a mob
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -225,18 +226,25 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelFFly(Player player) {
|
private void cancelFFly(Player player) {
|
||||||
if (player == null) return;
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
if (fPlayer.isFlying()) fPlayer.setFFlying(false, true);
|
if (fPlayer.isFlying()) {
|
||||||
|
fPlayer.setFFlying(false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelFStuckTeleport(Player player) {
|
public void cancelFStuckTeleport(Player player) {
|
||||||
if (player == null) return;
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
if (FactionsPlugin.getInstance().getStuckMap().containsKey(uuid))
|
if (FactionsPlugin.getInstance().getStuckMap().containsKey(uuid)) {
|
||||||
FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED);
|
FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED);
|
||||||
FactionsPlugin.getInstance().getStuckMap().remove(uuid);
|
FactionsPlugin.getInstance().getStuckMap().remove(uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
@@ -286,9 +294,10 @@ public class FactionsEntityListener implements Listener {
|
|||||||
private boolean checkExplosionForBlock(Entity boomer, Block block) {
|
private boolean checkExplosionForBlock(Entity boomer, Block block) {
|
||||||
Faction faction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
|
Faction faction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
|
||||||
|
|
||||||
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom))
|
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom)) {
|
||||||
return false;
|
|
||||||
// faction is peaceful and has explosions set to disabled
|
// faction is peaceful and has explosions set to disabled
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boolean online = faction.hasPlayersOnline();
|
boolean online = faction.hasPlayersOnline();
|
||||||
|
|
||||||
@@ -316,8 +325,9 @@ public class FactionsEntityListener implements Listener {
|
|||||||
@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)) event.setCancelled(true);
|
if (!this.canDamagerHurtDamagee(sub, false)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
@@ -330,11 +340,14 @@ public class FactionsEntityListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!badjuju) return;
|
if (!badjuju) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ProjectileSource thrower = event.getPotion().getShooter();
|
ProjectileSource thrower = event.getPotion().getShooter();
|
||||||
if (!(thrower instanceof Entity)) return;
|
if (!(thrower instanceof Entity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (thrower instanceof Player) {
|
if (thrower instanceof Player) {
|
||||||
Player player = (Player) thrower;
|
Player player = (Player) thrower;
|
||||||
@@ -348,14 +361,16 @@ public class FactionsEntityListener implements Listener {
|
|||||||
// scan through affected entities to make sure they're all valid targets
|
// scan through affected entities to make sure they're all valid targets
|
||||||
for (LivingEntity target : event.getAffectedEntities()) {
|
for (LivingEntity target : event.getAffectedEntities()) {
|
||||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent((Entity) thrower, target, EntityDamageEvent.DamageCause.CUSTOM, 0);
|
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent((Entity) thrower, target, EntityDamageEvent.DamageCause.CUSTOM, 0);
|
||||||
if (!this.canDamagerHurtDamagee(sub, true))
|
if (!this.canDamagerHurtDamagee(sub, true)) {
|
||||||
event.setIntensity(target, 0.0); // affected entity list doesn't accept modification (so no iter.remove()), but this works
|
event.setIntensity(target, 0.0); // affected entity list doesn't accept modification (so no iter.remove()), but this works
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerInSafeZone(Entity damagee) {
|
public boolean isPlayerInSafeZone(Entity damagee) {
|
||||||
if (!(damagee instanceof Player)) return false;
|
if (!(damagee instanceof Player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,13 +382,15 @@ public class FactionsEntityListener implements Listener {
|
|||||||
Entity damager = sub.getDamager();
|
Entity damager = sub.getDamager();
|
||||||
Entity damagee = sub.getEntity();
|
Entity damagee = sub.getEntity();
|
||||||
|
|
||||||
if (!(damagee instanceof Player)) return true;
|
if (!(damagee instanceof Player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
||||||
|
|
||||||
if (defender == null || defender.getPlayer() == null) return true;
|
if (defender == null || defender.getPlayer() == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Location defenderLoc = defender.getPlayer().getLocation();
|
Location defenderLoc = defender.getPlayer().getLocation();
|
||||||
Faction defLocFaction = Board.getInstance().getFactionAt(new FLocation(defenderLoc));
|
Faction defLocFaction = Board.getInstance().getFactionAt(new FLocation(defenderLoc));
|
||||||
@@ -382,11 +399,17 @@ public class FactionsEntityListener implements Listener {
|
|||||||
if (damager instanceof Projectile) {
|
if (damager instanceof Projectile) {
|
||||||
Projectile projectile = (Projectile) damager;
|
Projectile projectile = (Projectile) damager;
|
||||||
|
|
||||||
if (!(projectile.getShooter() instanceof Entity)) return true;
|
if (!(projectile.getShooter() instanceof Entity)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
damager = (Entity) projectile.getShooter();
|
damager = (Entity) projectile.getShooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damager == damagee) return true; // ender pearl usage and other self-inflicted damage
|
if (damager == damagee) // ender pearl usage and other self-inflicted damage
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Players can not take attack damage in a SafeZone, or possibly peaceful territory
|
// Players can not take attack damage in a SafeZone, or possibly peaceful territory
|
||||||
if (defLocFaction.noPvPInTerritory()) {
|
if (defLocFaction.noPvPInTerritory()) {
|
||||||
@@ -400,16 +423,19 @@ public class FactionsEntityListener implements Listener {
|
|||||||
return !defLocFaction.noMonstersInTerritory();
|
return !defLocFaction.noMonstersInTerritory();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(damager instanceof Player)) return true;
|
if (!(damager instanceof Player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
||||||
|
|
||||||
if (attacker == null || attacker.getPlayer() == null) return true;
|
if (attacker == null || attacker.getPlayer() == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (Conf.playersWhoBypassAllProtection.contains(attacker.getName())) return true;
|
|
||||||
|
|
||||||
|
if (Conf.playersWhoBypassAllProtection.contains(attacker.getName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (attacker.hasLoginPvpDisabled()) {
|
if (attacker.hasLoginPvpDisabled()) {
|
||||||
if (notify) {
|
if (notify) {
|
||||||
@@ -428,11 +454,13 @@ public class FactionsEntityListener implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locFaction.isWarZone() && Conf.warZoneFriendlyFire) return true;
|
if (locFaction.isWarZone() && Conf.warZoneFriendlyFire) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (Conf.worldsIgnorePvP.contains(defenderLoc.getWorld().getName())) return true;
|
|
||||||
|
|
||||||
|
if (Conf.worldsIgnorePvP.contains(defenderLoc.getWorld().getName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Faction defendFaction = defender.getFaction();
|
Faction defendFaction = defender.getFaction();
|
||||||
Faction attackFaction = attacker.getFaction();
|
Faction attackFaction = attacker.getFaction();
|
||||||
@@ -477,8 +505,9 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Players without faction may be hurt anywhere
|
// Players without faction may be hurt anywhere
|
||||||
if (!defender.hasFaction()) return true;
|
if (!defender.hasFaction()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// You can never hurt faction members or allies
|
// You can never hurt faction members or allies
|
||||||
if (relation.isMember() || relation.isAlly() || relation.isTruce()) {
|
if (relation.isMember() || relation.isAlly() || relation.isTruce()) {
|
||||||
@@ -517,8 +546,9 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
@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) return;
|
if (event.getLocation() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Conf.safeZoneNerfedCreatureTypes.contains(event.getEntityType()) && Board.getInstance().getFactionAt(new FLocation(event.getLocation())).noMonstersInTerritory()) {
|
if (Conf.safeZoneNerfedCreatureTypes.contains(event.getEntityType()) && Board.getInstance().getFactionAt(new FLocation(event.getLocation())).noMonstersInTerritory()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@@ -529,10 +559,14 @@ public class FactionsEntityListener implements Listener {
|
|||||||
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();
|
||||||
if (target == null) return;
|
if (target == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We are interested in blocking targeting for certain mobs:
|
// We are interested in blocking targeting for certain mobs:
|
||||||
if (!Conf.safeZoneNerfedCreatureTypes.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) return;
|
if (!Conf.safeZoneNerfedCreatureTypes.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// in case the target is in a safe zone.
|
// in case the target is in a safe zone.
|
||||||
if (Board.getInstance().getFactionAt(new FLocation(target.getLocation())).noMonstersInTerritory()) {
|
if (Board.getInstance().getFactionAt(new FLocation(target.getLocation())).noMonstersInTerritory()) {
|
||||||
@@ -601,8 +635,9 @@ public class FactionsEntityListener implements Listener {
|
|||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
// for now, only interested in Enderman and Wither boss tomfoolery
|
// for now, only interested in Enderman and Wither boss tomfoolery
|
||||||
if (!(entity instanceof Enderman) && !(entity instanceof Wither)) return;
|
if (!(entity instanceof Enderman) && !(entity instanceof Wither)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Location loc = event.getBlock().getLocation();
|
Location loc = event.getBlock().getLocation();
|
||||||
|
|
||||||
@@ -624,9 +659,9 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTravel(PlayerPortalEvent event) {
|
public void onTravel(PlayerPortalEvent event) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("portals.limit", false))
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("portals.limit", false)) {
|
||||||
return; // Don't do anything if they don't want us to.
|
return; // Don't do anything if they don't want us to.
|
||||||
|
}
|
||||||
|
|
||||||
TravelAgent agent = event.getPortalTravelAgent();
|
TravelAgent agent = event.getPortalTravelAgent();
|
||||||
|
|
||||||
@@ -703,27 +738,30 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean stopEndermanBlockManipulation(Location loc) {
|
private boolean stopEndermanBlockManipulation(Location loc) {
|
||||||
if (loc == null) return false;
|
if (loc == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// quick check to see if all Enderman deny options are enabled; if so, no need to check location
|
// quick check to see if all Enderman deny options are enabled; if so, no need to check location
|
||||||
if (Conf.wildernessDenyEndermanBlocks &&
|
if (Conf.wildernessDenyEndermanBlocks &&
|
||||||
Conf.territoryDenyEndermanBlocks &&
|
Conf.territoryDenyEndermanBlocks &&
|
||||||
Conf.territoryDenyEndermanBlocksWhenOffline &&
|
Conf.territoryDenyEndermanBlocksWhenOffline &&
|
||||||
Conf.safeZoneDenyEndermanBlocks &&
|
Conf.safeZoneDenyEndermanBlocks &&
|
||||||
Conf.warZoneDenyEndermanBlocks) return true;
|
Conf.warZoneDenyEndermanBlocks) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
FLocation fLoc = new FLocation(loc);
|
FLocation fLoc = new FLocation(loc);
|
||||||
Faction claimFaction = Board.getInstance().getFactionAt(fLoc);
|
Faction claimFaction = Board.getInstance().getFactionAt(fLoc);
|
||||||
|
|
||||||
if (claimFaction.isWilderness())
|
if (claimFaction.isWilderness()) {
|
||||||
return Conf.wildernessDenyEndermanBlocks;
|
return Conf.wildernessDenyEndermanBlocks;
|
||||||
else if (claimFaction.isNormal())
|
} else if (claimFaction.isNormal()) {
|
||||||
return claimFaction.hasPlayersOnline() ? Conf.territoryDenyEndermanBlocks : Conf.territoryDenyEndermanBlocksWhenOffline;
|
return claimFaction.hasPlayersOnline() ? Conf.territoryDenyEndermanBlocks : Conf.territoryDenyEndermanBlocksWhenOffline;
|
||||||
else if (claimFaction.isSafeZone())
|
} else if (claimFaction.isSafeZone()) {
|
||||||
return Conf.safeZoneDenyEndermanBlocks;
|
return Conf.safeZoneDenyEndermanBlocks;
|
||||||
else if (claimFaction.isWarZone())
|
} else if (claimFaction.isWarZone()) {
|
||||||
return Conf.warZoneDenyEndermanBlocks;
|
return Conf.warZoneDenyEndermanBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -51,11 +50,16 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
public static Set<FLocation> corners;
|
public static Set<FLocation> corners;
|
||||||
// Holds the next time a player can have a map shown.
|
// Holds the next time a player can have a map shown.
|
||||||
private HashMap<UUID, Long> showTimes = new HashMap<>();
|
private HashMap<UUID, Long> showTimes = new HashMap<>();
|
||||||
|
// for handling people who repeatedly spam attempts to open a door (or similar) in another faction's territory
|
||||||
|
private Map<String, InteractAttemptSpam> interactSpammers = new HashMap<>();
|
||||||
|
|
||||||
public FactionsPlayerListener() {
|
public FactionsPlayerListener() {
|
||||||
for (Player player : FactionsPlugin.getInstance().getServer().getOnlinePlayers()) initPlayer(player);
|
for (Player player : FactionsPlugin.getInstance().getServer().getOnlinePlayers()) {
|
||||||
if (positionTask == null) startPositionCheck();
|
initPlayer(player);
|
||||||
if (!FactionsPlugin.getInstance().mc17) loadCorners();
|
}
|
||||||
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
|
loadCorners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadCorners() {
|
public static void loadCorners() {
|
||||||
@@ -291,23 +295,25 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction factionToCheck, Access access, PermissableAction action, boolean pain) {
|
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction factionToCheck, Access access, PermissableAction action, boolean pain) {
|
||||||
boolean doPain = pain || Conf.handleExploitInteractionSpam; // Painbuild should take priority. But we want to use exploit interaction as well.
|
boolean doPain = pain && Conf.handleExploitInteractionSpam;
|
||||||
if (access != null) {
|
if (access != null && access != Access.UNDEFINED) {
|
||||||
|
// TODO: Update this once new access values are added other than just allow / deny.
|
||||||
boolean landOwned = (factionToCheck.doesLocationHaveOwnersSet(loc) && !factionToCheck.getOwnerList(loc).isEmpty());
|
boolean landOwned = (factionToCheck.doesLocationHaveOwnersSet(loc) && !factionToCheck.getOwnerList(loc).isEmpty());
|
||||||
if ((landOwned && factionToCheck.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(factionToCheck.getId()))) {
|
if ((landOwned && factionToCheck.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(factionToCheck.getId()))) {
|
||||||
return true;
|
return true;
|
||||||
} else if (landOwned && !factionToCheck.getOwnerListString(loc).contains(player.getName())) {
|
} else if (landOwned && !factionToCheck.getOwnerListString(loc).contains(player.getName())) {
|
||||||
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY, factionToCheck.getOwnerListString(loc));
|
me.msg("<b>You can't do that in this territory, it is owned by: " + factionToCheck.getOwnerListString(loc));
|
||||||
if (doPain) player.damage(Conf.actionDeniedPainAmount);
|
if (doPain) {
|
||||||
|
player.damage(Conf.actionDeniedPainAmount);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (!landOwned && access == Access.ALLOW) {
|
} else if (!landOwned && access == Access.ALLOW) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
me.msg(TL.PLAYER_USE_TERRITORY, action, factionToCheck.getTag(me.getFaction()));
|
me.msg("You cannot " + action + " in the territory of " + factionToCheck.getTag(me.getFaction()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Approves any permission check if the player in question is a leader AND owns the faction.
|
// Approves any permission check if the player in question is a leader AND owns the faction.
|
||||||
if (me.getRole().equals(Role.LEADER) && me.getFaction().equals(factionToCheck)) return true;
|
if (me.getRole().equals(Role.LEADER) && me.getFaction().equals(factionToCheck)) return true;
|
||||||
if (factionToCheck != null) {
|
if (factionToCheck != null) {
|
||||||
@@ -323,16 +329,20 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
return GetPermissionFromUsableBlock(block.getType());
|
return GetPermissionFromUsableBlock(block.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This will try to resolve a permission action based on the item material, if it's not usable, will return null
|
||||||
|
/// <summary>
|
||||||
private static PermissableAction GetPermissionFromUsableBlock(Material material) {
|
private static PermissableAction GetPermissionFromUsableBlock(Material material) {
|
||||||
// Check for doors that might have diff material name in old version.
|
// Check for doors that might have diff material name in old version.
|
||||||
if (material.name().contains("DOOR") || material.name().contains("FENCE_GATE"))
|
if (material.name().contains("DOOR") || material.name().contains("FENCE_GATE"))
|
||||||
return PermissableAction.DOOR;
|
return PermissableAction.DOOR;
|
||||||
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE") || material.name().contains("DIODE") || material.name().contains("COMPARATOR"))
|
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE"))
|
||||||
return PermissableAction.BUTTON;
|
return PermissableAction.BUTTON;
|
||||||
if (FactionsPlugin.instance.mc113 || FactionsPlugin.instance.mc114) {
|
if (FactionsPlugin.getInstance().mc113) {
|
||||||
switch (material) {
|
switch (material) {
|
||||||
case LEVER:
|
case LEVER:
|
||||||
return PermissableAction.LEVER;
|
return PermissableAction.LEVER;
|
||||||
|
|
||||||
case ACACIA_BUTTON:
|
case ACACIA_BUTTON:
|
||||||
case BIRCH_BUTTON:
|
case BIRCH_BUTTON:
|
||||||
case DARK_OAK_BUTTON:
|
case DARK_OAK_BUTTON:
|
||||||
@@ -340,8 +350,6 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case OAK_BUTTON:
|
case OAK_BUTTON:
|
||||||
case SPRUCE_BUTTON:
|
case SPRUCE_BUTTON:
|
||||||
case STONE_BUTTON:
|
case STONE_BUTTON:
|
||||||
case COMPARATOR:
|
|
||||||
case REPEATER:
|
|
||||||
return PermissableAction.BUTTON;
|
return PermissableAction.BUTTON;
|
||||||
|
|
||||||
case ACACIA_DOOR:
|
case ACACIA_DOOR:
|
||||||
@@ -416,10 +424,11 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
case IRON_DOOR:
|
case IRON_DOOR:
|
||||||
case JUNGLE_DOOR:
|
case JUNGLE_DOOR:
|
||||||
case SPRUCE_DOOR:
|
case SPRUCE_DOOR:
|
||||||
|
|
||||||
case ACACIA_FENCE_GATE:
|
case ACACIA_FENCE_GATE:
|
||||||
case BIRCH_FENCE_GATE:
|
case BIRCH_FENCE_GATE:
|
||||||
case OAK_FENCE_GATE:
|
|
||||||
case DARK_OAK_FENCE_GATE:
|
case DARK_OAK_FENCE_GATE:
|
||||||
|
case OAK_FENCE_GATE:
|
||||||
case JUNGLE_FENCE_GATE:
|
case JUNGLE_FENCE_GATE:
|
||||||
case SPRUCE_FENCE_GATE:
|
case SPRUCE_FENCE_GATE:
|
||||||
return PermissableAction.DOOR;
|
return PermissableAction.DOOR;
|
||||||
@@ -460,34 +469,41 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
me.login(); // set kills / deaths
|
me.login(); // set kills / deaths
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(FactionsPlugin.instance, () -> {
|
// Check for Faction announcements. Let's delay this so they actually see it.
|
||||||
if (me.isOnline()) me.getFaction().sendUnreadAnnouncements(me);
|
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> {
|
||||||
}, 33L);
|
if (me.isOnline()) {
|
||||||
|
me.getFaction().sendUnreadAnnouncements(me);
|
||||||
|
}
|
||||||
|
}, 33L); // Don't ask me why.
|
||||||
|
|
||||||
if (FactionsPlugin.instance.getConfig().getBoolean("scoreboard.default-enabled", false)) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("scoreboard.default-enabled", false)) {
|
||||||
FScoreboard.init(me);
|
FScoreboard.init(me);
|
||||||
FScoreboard.get(me).setDefaultSidebar(new FDefaultSidebar(), FactionsPlugin.instance.getConfig().getInt("scoreboard.default-update-interval", 20));
|
FScoreboard.get(me).setDefaultSidebar(new FDefaultSidebar(), FactionsPlugin.getInstance().getConfig().getInt("scoreboard.default-update-interval", 20));
|
||||||
FScoreboard.get(me).setSidebarVisibility(me.showScoreboard());
|
FScoreboard.get(me).setSidebarVisibility(me.showScoreboard());
|
||||||
}
|
}
|
||||||
|
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
if (!myFaction.isWilderness()) {
|
if (!myFaction.isWilderness()) {
|
||||||
for (FPlayer other : myFaction.getFPlayersWhereOnline(true)) {
|
for (FPlayer other : myFaction.getFPlayersWhereOnline(true)) {
|
||||||
if (other != me && other.isMonitoringJoins()) other.msg(TL.FACTION_LOGIN, me.getName());
|
if (other != me && other.isMonitoringJoins()) {
|
||||||
|
other.msg(TL.FACTION_LOGIN, me.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fallMap.put(me.getPlayer(), false);
|
fallMap.put(me.getPlayer(), false);
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(FactionsPlugin.instance, () -> fallMap.remove(me.getPlayer()), 180L);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(FactionsPlugin.getInstance(), () -> fallMap.remove(me.getPlayer()), 180L);
|
||||||
|
|
||||||
|
|
||||||
if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) {
|
if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) {
|
||||||
me.setSpyingChat(false);
|
me.setSpyingChat(false);
|
||||||
FactionsPlugin.instance.log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName());
|
FactionsPlugin.getInstance().log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me.isAdminBypassing() && !player.hasPermission(Permission.BYPASS.node)) {
|
if (me.isAdminBypassing() && !player.hasPermission(Permission.BYPASS.node)) {
|
||||||
me.setIsAdminBypassing(false);
|
me.setIsAdminBypassing(false);
|
||||||
FactionsPlugin.instance.log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName());
|
FactionsPlugin.getInstance().log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -521,19 +537,23 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
me.logout(); // cache kills / deaths
|
me.logout(); // cache kills / deaths
|
||||||
|
|
||||||
// if player is waiting for fstuck teleport but leaves, remove
|
// if player is waiting for fstuck teleport but leaves, remove
|
||||||
if (FactionsPlugin.instance.getStuckMap().containsKey(me.getPlayer().getUniqueId())) {
|
if (FactionsPlugin.getInstance().getStuckMap().containsKey(me.getPlayer().getUniqueId())) {
|
||||||
FPlayers.getInstance().getByPlayer(me.getPlayer()).msg(TL.COMMAND_STUCK_CANCELLED);
|
FPlayers.getInstance().getByPlayer(me.getPlayer()).msg(TL.COMMAND_STUCK_CANCELLED);
|
||||||
FactionsPlugin.instance.getStuckMap().remove(me.getPlayer().getUniqueId());
|
FactionsPlugin.getInstance().getStuckMap().remove(me.getPlayer().getUniqueId());
|
||||||
FactionsPlugin.instance.getTimers().remove(me.getPlayer().getUniqueId());
|
FactionsPlugin.getInstance().getTimers().remove(me.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
if (!myFaction.isWilderness()) myFaction.memberLoggedOff();
|
if (!myFaction.isWilderness()) {
|
||||||
|
myFaction.memberLoggedOff();
|
||||||
|
}
|
||||||
|
|
||||||
if (!myFaction.isWilderness()) {
|
if (!myFaction.isWilderness()) {
|
||||||
for (FPlayer player : myFaction.getFPlayersWhereOnline(true))
|
for (FPlayer player : myFaction.getFPlayersWhereOnline(true)) {
|
||||||
if (player != me && player.isMonitoringJoins()) player.msg(TL.FACTION_LOGOUT, me.getName());
|
if (player != me && player.isMonitoringJoins()) {
|
||||||
|
player.msg(TL.FACTION_LOGOUT, me.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdSeeChunk.seeChunkMap.remove(event.getPlayer().getName());
|
CmdSeeChunk.seeChunkMap.remove(event.getPlayer().getName());
|
||||||
@@ -550,17 +570,23 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
.replace("{chunks}", faction.getAllClaims().size() + "")
|
.replace("{chunks}", faction.getAllClaims().size() + "")
|
||||||
.replace("{power}", faction.getPower() + "")
|
.replace("{power}", faction.getPower() + "")
|
||||||
.replace("{leader}", faction.getFPlayerAdmin() + "");
|
.replace("{leader}", faction.getFPlayerAdmin() + "");
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableFly(FPlayer me) {
|
public void enableFly(FPlayer me) {
|
||||||
if (!FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable")) return; // Looks prettier sorry
|
if (!me.getPlayer().hasPermission(Permission.FLY.node)) return;
|
||||||
if (!me.canFlyAtLocation()) return;
|
|
||||||
me.setFFlying(true, false);
|
me.setFFlying(true, false);
|
||||||
CmdFly.flyMap.put(me.getName(), true);
|
|
||||||
if (CmdFly.particleTask == null)
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("ffly.AutoEnable")) {
|
||||||
CmdFly.startParticles();
|
me.setFlying(true);
|
||||||
}
|
CmdFly.flyMap.put(me.getName(), true);
|
||||||
|
if (CmdFly.particleTask == null)
|
||||||
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("ffly.Particles.Enabled"))
|
||||||
|
CmdFly.startParticles();
|
||||||
|
}
|
||||||
|
if (CmdFly.flyTask == null) CmdFly.startFlyCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//inspect
|
//inspect
|
||||||
@@ -596,8 +622,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
.replace("{y}", e.getClickedBlock().getY() + "")
|
.replace("{y}", e.getClickedBlock().getY() + "")
|
||||||
.replace("{z}", e.getClickedBlock().getZ() + ""));
|
.replace("{z}", e.getClickedBlock().getZ() + ""));
|
||||||
String rowFormat = TL.COMMAND_INSPECT_ROW.toString();
|
String rowFormat = TL.COMMAND_INSPECT_ROW.toString();
|
||||||
for (String[] strings : info) {
|
for (int i = 0; i < info.size(); i++) {
|
||||||
CoreProtectAPI.ParseResult row = coAPI.parseResult(strings);
|
CoreProtectAPI.ParseResult row = coAPI.parseResult(info.get(i));
|
||||||
player.sendMessage(rowFormat
|
player.sendMessage(rowFormat
|
||||||
.replace("{time}", convertTime(row.getTime()))
|
.replace("{time}", convertTime(row.getTime()))
|
||||||
.replace("{action}", row.getActionString())
|
.replace("{action}", row.getActionString())
|
||||||
@@ -613,9 +639,11 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if (player.getItemInHand().getType() == Material.ENDER_PEARL) {
|
if (player.getItemInHand().getType() == Material.ENDER_PEARL) {
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||||
if (fPlayer.isFlying() && Conf.noEnderpearlsInFly) {
|
if (fPlayer.isFlying()) {
|
||||||
fPlayer.msg(TL.COMMAND_FLY_NO_EPEARL);
|
if (Conf.noEnderpearlsInFly) {
|
||||||
e.setCancelled(true);
|
fPlayer.msg(TL.COMMAND_FLY_NO_EPEARL);
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -625,59 +653,16 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BukkitTask positionTask = null;
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public static Map<UUID, Location> lastLocations = new HashMap<>();
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
public void startPositionCheck() {
|
|
||||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.instance, () -> {
|
|
||||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (!lastLocations.containsKey(player.getUniqueId())) {
|
|
||||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
refreshPosition(player, lastLocations.get(player.getUniqueId()), player.getLocation());
|
|
||||||
lastLocations.put(player.getUniqueId(), player.getLocation());
|
|
||||||
if (CmdFly.flyMap.containsKey(player.getName())) {
|
|
||||||
String name = player.getName();
|
|
||||||
if (!player.isFlying()
|
|
||||||
|| player.getGameMode() == GameMode.CREATIVE
|
|
||||||
|| !FactionsPlugin.instance.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
|
||||||
Faction myFaction = fPlayer.getFaction();
|
|
||||||
if (myFaction.isWilderness()) {
|
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fPlayer.setFlying(false));
|
|
||||||
CmdFly.flyMap.remove(player.getName());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> {
|
|
||||||
if (!fPlayer.checkIfNearbyEnemies()) {
|
|
||||||
FLocation myFloc = new FLocation(player.getLocation());
|
|
||||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
|
||||||
if (!CmdFly.checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
|
|
||||||
fPlayer.setFFlying(false, false);
|
|
||||||
CmdFly.flyMap.remove(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 5L, 10L);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshPosition(Player player, Location oldLocation, Location newLocation) {
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||||
|
|
||||||
// clear visualization
|
// clear visualization
|
||||||
if (oldLocation.getBlockX() != newLocation.getBlockX()
|
if (event.getFrom().getBlockX() != event.getTo().getBlockX()
|
||||||
|| oldLocation.getBlockY() != newLocation.getBlockY()
|
|| event.getFrom().getBlockY() != event.getTo().getBlockY()
|
||||||
|| oldLocation.getBlockZ() != newLocation.getBlockZ()) {
|
|| event.getFrom().getBlockZ() != event.getTo().getBlockZ()) {
|
||||||
VisualizeUtil.clear(player);
|
VisualizeUtil.clear(event.getPlayer());
|
||||||
if (me.isWarmingUp()) {
|
if (me.isWarmingUp()) {
|
||||||
me.clearWarmup();
|
me.clearWarmup();
|
||||||
me.msg(TL.WARMUPS_CANCELLED);
|
me.msg(TL.WARMUPS_CANCELLED);
|
||||||
@@ -685,20 +670,23 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// quick check to make sure player is moving between chunks; good performance boost
|
// quick check to make sure player is moving between chunks; good performance boost
|
||||||
if (oldLocation.getBlockX() >> 4 == newLocation.getBlockX() >> 4
|
if (event.getFrom().getBlockX() >> 4 == event.getTo().getBlockX() >> 4
|
||||||
&& oldLocation.getBlockZ() >> 4 == newLocation.getBlockZ() >> 4
|
&& event.getFrom().getBlockZ() >> 4 == event.getTo().getBlockZ() >> 4
|
||||||
&& oldLocation.getWorld() == newLocation.getWorld()) {
|
&& event.getFrom().getWorld() == event.getTo().getWorld()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Did we change coord?
|
// Did we change coord?
|
||||||
FLocation from = me.getLastStoodAt();
|
FLocation from = me.getLastStoodAt();
|
||||||
FLocation to = new FLocation(player.getLocation());
|
FLocation to = new FLocation(event.getTo());
|
||||||
|
|
||||||
if (from.equals(to)) return;
|
if (from.equals(to)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Yes we did change coord (:
|
// Yes we did change coord (:
|
||||||
|
|
||||||
me.setLastStoodAt(to);
|
me.setLastStoodAt(to);
|
||||||
|
|
||||||
// Did we change "host"(faction)?
|
// Did we change "host"(faction)?
|
||||||
@@ -708,34 +696,43 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
|
|
||||||
if (changedFaction) {
|
if (changedFaction) {
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> Bukkit.getServer().getPluginManager().callEvent(new FPlayerEnteredFactionEvent(factionTo, factionFrom, me)));
|
Bukkit.getServer().getPluginManager().callEvent(new FPlayerEnteredFactionEvent(factionTo, factionFrom, me));
|
||||||
if (FactionsPlugin.instance.getConfig().getBoolean("Title.Show-Title")) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("Title.Show-Title")) {
|
||||||
String title = FactionsPlugin.instance.getConfig().getString("Title.Format.Title");
|
String title = FactionsPlugin.getInstance().getConfig().getString("Title.Format.Title");
|
||||||
title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
|
title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
|
||||||
title = parseAllPlaceholders(title, factionTo, player);
|
title = parseAllPlaceholders(title, factionTo, player);
|
||||||
String subTitle = FactionsPlugin.instance.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
|
String subTitle = FactionsPlugin.getInstance().getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
|
||||||
subTitle = parseAllPlaceholders(subTitle, factionTo, player);
|
subTitle = parseAllPlaceholders(subTitle, factionTo, player);
|
||||||
final String finalTitle = title;
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
final String finalsubTitle = subTitle;
|
if (!FactionsPlugin.getInstance().mc18) {
|
||||||
if (!FactionsPlugin.instance.mc17) {
|
me.getPlayer().sendTitle(FactionsPlugin.getInstance().color(title), FactionsPlugin.getInstance().color(subTitle), FactionsPlugin.getInstance().getConfig().getInt("Title.Options.FadeInTime"),
|
||||||
Bukkit.getScheduler().runTaskLater(FactionsPlugin.instance, () -> {
|
FactionsPlugin.getInstance().getConfig().getInt("Title.Options.ShowTime"),
|
||||||
if (!FactionsPlugin.instance.mc18) {
|
FactionsPlugin.getInstance().getConfig().getInt("Title.Options.FadeOutTime"));
|
||||||
me.getPlayer().sendTitle(FactionsPlugin.instance.color(finalTitle), FactionsPlugin.instance.color(finalsubTitle), FactionsPlugin.instance.getConfig().getInt("Title.Options.FadeInTime"),
|
} else {
|
||||||
FactionsPlugin.instance.getConfig().getInt("Title.Options.ShowTime"),
|
me.getPlayer().sendTitle(FactionsPlugin.getInstance().color(title), FactionsPlugin.getInstance().color(subTitle));
|
||||||
FactionsPlugin.instance.getConfig().getInt("Title.Options.FadeOutTime"));
|
}
|
||||||
} else {
|
|
||||||
me.getPlayer().sendTitle(FactionsPlugin.instance.color(finalTitle), FactionsPlugin.instance.color(finalsubTitle));
|
|
||||||
}
|
|
||||||
}, 5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!me.isFlying()) {
|
|
||||||
enableFly(me);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// enable fly :)
|
||||||
|
if (FactionsPlugin.getInstance().factionsFlight && me.hasFaction() && !me.isFlying()) {
|
||||||
|
if (factionTo == me.getFaction()) enableFly(me);
|
||||||
|
// bypass checks
|
||||||
|
Relation 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() && !isSystemFaction(factionTo))) {
|
||||||
|
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> enableFly(me));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (me.getAutoClaimFor() != null) {
|
if (me.getAutoClaimFor() != null) {
|
||||||
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
me.attemptClaim(me.getAutoClaimFor(), event.getTo(), true);
|
||||||
if (Conf.disableFlightOnFactionClaimChange) CmdFly.disableFlight(me);
|
if (Conf.disableFlightOnFactionClaimChange && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||||
|
CmdFly.disableFlight(me);
|
||||||
} else if (me.isAutoSafeClaimEnabled()) {
|
} else if (me.isAutoSafeClaimEnabled()) {
|
||||||
if (!Permission.MANAGE_SAFE_ZONE.has(player)) {
|
if (!Permission.MANAGE_SAFE_ZONE.has(player)) {
|
||||||
me.setIsAutoSafeClaimEnabled(false);
|
me.setIsAutoSafeClaimEnabled(false);
|
||||||
@@ -757,26 +754,27 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (me.isMapAutoUpdating()) {
|
if (me.isMapAutoUpdating()) {
|
||||||
if (showTimes.containsKey(player.getUniqueId()) && (showTimes.get(player.getUniqueId()) > System.currentTimeMillis())) {
|
if (showTimes.containsKey(player.getUniqueId()) && (showTimes.get(player.getUniqueId()) > System.currentTimeMillis())) {
|
||||||
if (FactionsPlugin.instance.getConfig().getBoolean("findfactionsexploit.log", false)) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("findfactionsexploit.log", false)) {
|
||||||
FactionsPlugin.instance.log(Level.WARNING, "%s tried to show a faction map too soon and triggered exploit blocker.", player.getName());
|
FactionsPlugin.getInstance().log(Level.WARNING, "%s tried to show a faction map too soon and triggered exploit blocker.", player.getName());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
me.sendFancyMessage(Board.getInstance().getMap(me, to, player.getLocation().getYaw()));
|
me.sendFancyMessage(Board.getInstance().getMap(me, to, player.getLocation().getYaw()));
|
||||||
showTimes.put(player.getUniqueId(), System.currentTimeMillis() + FactionsPlugin.instance.getConfig().getLong("findfactionsexploit.cooldown", 2000));
|
showTimes.put(player.getUniqueId(), System.currentTimeMillis() + FactionsPlugin.getInstance().getConfig().getLong("findfactionsexploit.cooldown", 2000));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
String ownersTo = myFaction.getOwnerListString(to);
|
String ownersTo = myFaction.getOwnerListString(to);
|
||||||
if (changedFaction) {
|
if (changedFaction) {
|
||||||
if (Conf.sendFactionChangeMessage) me.sendFactionHereMessage(factionFrom);
|
me.sendFactionHereMessage(factionFrom);
|
||||||
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
|
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty() && me.hasNotificationsEnabled()) {
|
||||||
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
||||||
}
|
}
|
||||||
} else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && !myFaction.isWilderness()) {
|
} else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && !myFaction.isWilderness()) {
|
||||||
String ownersFrom = myFaction.getOwnerListString(from);
|
String ownersFrom = myFaction.getOwnerListString(from);
|
||||||
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) {
|
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo) && me.hasNotificationsEnabled()) {
|
||||||
if (!ownersTo.isEmpty()) {
|
if (!ownersTo.isEmpty()) {
|
||||||
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
||||||
} else if (!TL.GENERIC_PUBLICLAND.toString().isEmpty()) {
|
} else if (!TL.GENERIC_PUBLICLAND.toString().isEmpty()) {
|
||||||
@@ -794,16 +792,15 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
if (fme.isInFactionsChest()) fme.setInFactionsChest(false);
|
if (fme.isInFactionsChest()) fme.setInFactionsChest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK))
|
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
|
||||||
|
if (event.getAction().equals(Action.LEFT_CLICK_BLOCK) || event.getAction().equals(Action.LEFT_CLICK_AIR))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
// Check if the material is bypassing protection
|
||||||
if (block == null) return;
|
if (block == null) return; // clicked in air, apparently
|
||||||
|
|
||||||
|
|
||||||
Material type;
|
Material type;
|
||||||
if (event.getItem() != null) {
|
if (event.getItem() != null) {
|
||||||
@@ -813,31 +810,26 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
type = null;
|
type = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creeper Egg Bypass.
|
if (Conf.territoryBypassProtectedMaterials.contains(block.getType())) return;
|
||||||
if (Conf.allowCreeperEggingChests && block.getType() == Material.CHEST && type == XMaterial.CREEPER_SPAWN_EGG.parseMaterial() && event.getPlayer().isSneaking()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) {
|
||||||
// territoryBypasssProtectedMaterials totally bypass the protection system
|
|
||||||
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
|
|
||||||
// Do type null checks so if XMaterial has a parsing issue and fills null as a value it will not bypass.
|
|
||||||
// territoryCancelAndAllowItemUseMaterial bypass the protection system but only if they're not clicking on territoryDenySwitchMaterials
|
|
||||||
// if they're clicking on territoryDenySwitchMaterials, let the protection system handle the permissions
|
|
||||||
if (type != null && !Conf.territoryDenySwitchMaterials.contains(block.getType())) {
|
|
||||||
if (Conf.territoryCancelAndAllowItemUseMaterial.contains(type)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetPermissionFromUsableBlock(block.getType()) != null) {
|
|
||||||
if (!canPlayerUseBlock(player, block, false)) {
|
if (!canPlayerUseBlock(player, block, false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setUseInteractedBlock(Event.Result.DENY);
|
event.setUseInteractedBlock(Event.Result.DENY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (event.getPlayer().getItemInHand() != null) {
|
||||||
|
Material handItem = event.getPlayer().getItemInHand().getType();
|
||||||
|
if (handItem.isEdible()
|
||||||
|
|| handItem.equals(XMaterial.POTION.parseMaterial())
|
||||||
|
|| handItem.equals(XMaterial.LINGERING_POTION.parseMaterial())
|
||||||
|
|| handItem.equals(XMaterial.SPLASH_POTION.parseMaterial())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getItem() == null) return;
|
||||||
if (type != null && !playerCanUseItemHere(player, block.getLocation(), event.getItem().getType(), false, PermissableAction.ITEM)) {
|
if (type != null && !playerCanUseItemHere(player, block.getLocation(), event.getItem().getType(), false, PermissableAction.ITEM)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setUseInteractedBlock(Event.Result.DENY);
|
event.setUseInteractedBlock(Event.Result.DENY);
|
||||||
@@ -845,7 +837,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventorySee(InventoryClickEvent e) {
|
public void onInentorySee(InventoryClickEvent e) {
|
||||||
if (e.getCurrentItem() == null)
|
if (e.getCurrentItem() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -858,6 +850,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerBoneMeal(PlayerInteractEvent event) {
|
public void onPlayerBoneMeal(PlayerInteractEvent event) {
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == XMaterial.GRASS_BLOCK.parseMaterial()
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == XMaterial.GRASS_BLOCK.parseMaterial()
|
||||||
&& event.hasItem() && event.getItem().getType() == XMaterial.BONE_MEAL.parseMaterial()) {
|
&& event.hasItem() && event.getItem().getType() == XMaterial.BONE_MEAL.parseMaterial()) {
|
||||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) {
|
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) {
|
||||||
@@ -942,7 +935,9 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerInteractGUI(InventoryClickEvent event) {
|
public void onPlayerInteractGUI(InventoryClickEvent event) {
|
||||||
if (event.getClickedInventory() == null) return;
|
if (event.getClickedInventory() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getClickedInventory().getHolder() instanceof FactionGUI) {
|
if (event.getClickedInventory().getHolder() instanceof FactionGUI) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
((FactionGUI) event.getClickedInventory().getHolder()).onClick(event.getRawSlot(), event.getClick());
|
((FactionGUI) event.getClickedInventory().getHolder()).onClick(event.getRawSlot(), event.getClick());
|
||||||
@@ -951,18 +946,23 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerMoveGUI(InventoryDragEvent event) {
|
public void onPlayerMoveGUI(InventoryDragEvent event) {
|
||||||
if (event.getInventory().getHolder() instanceof FactionGUI) event.setCancelled(true);
|
if (event.getInventory().getHolder() instanceof FactionGUI) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerKick(PlayerKickEvent event) {
|
public void onPlayerKick(PlayerKickEvent event) {
|
||||||
FPlayer badGuy = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
FPlayer badGuy = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
if (badGuy == null) return;
|
if (badGuy == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if player was banned (not just kicked), get rid of their stored info
|
// if player was banned (not just kicked), get rid of their stored info
|
||||||
if (Conf.removePlayerDataWhenBanned && event.getReason().equals("Banned by admin.")) {
|
if (Conf.removePlayerDataWhenBanned && event.getReason().equals("Banned by admin.")) {
|
||||||
if (badGuy.getRole() == Role.LEADER) badGuy.getFaction().promoteNewLeader();
|
if (badGuy.getRole() == Role.LEADER) {
|
||||||
|
badGuy.getFaction().promoteNewLeader();
|
||||||
|
}
|
||||||
|
|
||||||
badGuy.leave(false);
|
badGuy.leave(false);
|
||||||
badGuy.remove();
|
badGuy.remove();
|
||||||
@@ -980,7 +980,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<FLocation> getCorners() {
|
public Set<FLocation> getCorners() {
|
||||||
return corners;
|
return this.corners;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -1020,6 +1020,23 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDisconnect(PlayerQuitEvent e) {
|
public void onDisconnect(PlayerQuitEvent e) {
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
if (fPlayer.isInFactionsChest()) fPlayer.setInFactionsChest(false);
|
if (fPlayer.isInFactionsChest()) fPlayer.setInFactionsChest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class InteractAttemptSpam {
|
||||||
|
private int attempts = 0;
|
||||||
|
private long lastAttempt = System.currentTimeMillis();
|
||||||
|
|
||||||
|
// returns the current attempt count
|
||||||
|
public int increment() {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
if (now > lastAttempt + 2000) {
|
||||||
|
attempts = 1;
|
||||||
|
} else {
|
||||||
|
attempts++;
|
||||||
|
}
|
||||||
|
lastAttempt = now;
|
||||||
|
return attempts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ public class CmdMissions extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
|
if (context.faction == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final MissionGUI missionsGUI = new MissionGUI(FactionsPlugin.getInstance(), context.fPlayer);
|
final MissionGUI missionsGUI = new MissionGUI(FactionsPlugin.getInstance(), context.fPlayer);
|
||||||
missionsGUI.build();
|
missionsGUI.build();
|
||||||
context.player.openInventory(missionsGUI.getInventory());
|
context.player.openInventory(missionsGUI.getInventory());
|
||||||
|
|||||||
@@ -30,44 +30,30 @@ public class MissionGUI implements FactionGUI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(int slot, ClickType action) {
|
public void onClick(int slot, ClickType action) {
|
||||||
String missionName = slots.get(slot);
|
|
||||||
if (missionName == null) return;
|
|
||||||
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("Missions");
|
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("Missions");
|
||||||
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Allowed.Name")))) {
|
if (configurationSection == null) {
|
||||||
Mission pickedMission = null;
|
return;
|
||||||
Set<String> keys = plugin.getConfig().getConfigurationSection("Missions").getKeys(false);
|
}
|
||||||
while (pickedMission == null) {
|
|
||||||
Random r = new Random();
|
|
||||||
int pick = r.nextInt(keys.size() - 1);
|
|
||||||
if (!keys.toArray()[pick].toString().equals("FillItem")) {
|
|
||||||
missionName = keys.toArray()[pick].toString();
|
|
||||||
if (!fPlayer.getFaction().getMissions().keySet().contains(missionName)) {
|
|
||||||
pickedMission = new Mission(missionName, plugin.getConfig().getString("Missions." + missionName + ".Mission.Type"));
|
|
||||||
fPlayer.getFaction().getMissions().put(missionName, pickedMission);
|
|
||||||
fPlayer.msg(TL.MISSION_MISSION_STARTED, fPlayer.describeTo(fPlayer.getFaction()), plugin.color(plugin.getConfig().getString("Missions." + missionName + ".Name")));
|
|
||||||
build();
|
|
||||||
fPlayer.getPlayer().openInventory(inventory);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (plugin.getConfig().getBoolean("Randomization.Enabled")) {return;}
|
|
||||||
if (configurationSection == null) return;
|
|
||||||
|
|
||||||
int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce");
|
int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce");
|
||||||
if (fPlayer.getFaction().getMissions().size() >= max) {
|
if (fPlayer.getFaction().getMissions().size() >= max) {
|
||||||
fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max);
|
fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) return;
|
String missionName = slots.get(slot);
|
||||||
|
if (missionName == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) {
|
||||||
|
//return;
|
||||||
|
//}
|
||||||
if (fPlayer.getFaction().getMissions().containsKey(missionName)) {
|
if (fPlayer.getFaction().getMissions().containsKey(missionName)) {
|
||||||
fPlayer.msg(TL.MISSION_MISSION_ACTIVE);
|
fPlayer.msg(TL.MISSION_MISSION_ACTIVE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ConfigurationSection section = configurationSection.getConfigurationSection(missionName);
|
ConfigurationSection section = configurationSection.getConfigurationSection(missionName);
|
||||||
if (section == null) return;
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
||||||
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
|
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
|
||||||
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
|
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
|
||||||
@@ -76,8 +62,27 @@ public class MissionGUI implements FactionGUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSection missionSection = section.getConfigurationSection("Mission");
|
ConfigurationSection missionSection = section.getConfigurationSection("Mission");
|
||||||
if (missionSection == null) return;
|
if (missionSection == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Coming soon (:
|
||||||
|
//if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Allowed.Name")))) {
|
||||||
|
//Mission pickedMission = null;
|
||||||
|
//Set<String> keys = plugin.getConfig().getConfigurationSection("Missions").getKeys(false);
|
||||||
|
//while (pickedMission == null) {
|
||||||
|
//Random r = new Random();
|
||||||
|
//int pick = r.nextInt(keys.size() - 1);
|
||||||
|
//if (!keys.toArray()[pick].toString().equals("FillItem")) {
|
||||||
|
//missionName = keys.toArray()[pick].toString();
|
||||||
|
//pickedMission = new Mission(missionName, plugin.getConfig().getString("Missions." + missionName + ".Mission.Type"));
|
||||||
|
//fPlayer.getFaction().getMissions().put(missionName, pickedMission);
|
||||||
|
//fPlayer.msg(TL.MISSION_MISSION_STARTED, fPlayer.describeTo(fPlayer.getFaction()), plugin.color(plugin.getConfig().getString("Missions." + missionName + ".Name")));
|
||||||
|
//build();
|
||||||
|
//fPlayer.getPlayer().openInventory(inventory);
|
||||||
|
//return;
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
//}
|
||||||
Mission mission = new Mission(missionName, missionSection.getString("Type"));
|
Mission mission = new Mission(missionName, missionSection.getString("Type"));
|
||||||
fPlayer.getFaction().getMissions().put(missionName, mission);
|
fPlayer.getFaction().getMissions().put(missionName, mission);
|
||||||
fPlayer.msg(TL.MISSION_MISSION_STARTED, fPlayer.describeTo(fPlayer.getFaction()), plugin.color(section.getString("Name")));
|
fPlayer.msg(TL.MISSION_MISSION_STARTED, fPlayer.describeTo(fPlayer.getFaction()), plugin.color(section.getString("Name")));
|
||||||
@@ -131,7 +136,8 @@ public class MissionGUI implements FactionGUI {
|
|||||||
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Material")).parseItem();
|
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Material")).parseItem();
|
||||||
meta = start.getItemMeta();
|
meta = start.getItemMeta();
|
||||||
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Name")));
|
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Name")));
|
||||||
List<String> loree = new ArrayList<>();
|
List<String> loree = meta.getLore();
|
||||||
|
loree.clear();
|
||||||
for (String string : plugin.getConfig().getStringList("Randomization.Start-Item.Allowed.Lore")) {
|
for (String string : plugin.getConfig().getStringList("Randomization.Start-Item.Allowed.Lore")) {
|
||||||
loree.add(plugin.color(string));
|
loree.add(plugin.color(string));
|
||||||
}
|
}
|
||||||
@@ -141,7 +147,8 @@ public class MissionGUI implements FactionGUI {
|
|||||||
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem();
|
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem();
|
||||||
meta = start.getItemMeta();
|
meta = start.getItemMeta();
|
||||||
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = meta.getLore();
|
||||||
|
lore.clear();
|
||||||
for (String string : plugin.getConfig().getStringList("Randomization.Start-Item.Disallowed.Lore")) {
|
for (String string : plugin.getConfig().getStringList("Randomization.Start-Item.Disallowed.Lore")) {
|
||||||
lore.add(plugin.color(string).replace("%reason%", TL.MISSION_MISSION_ALL_COMPLETED.toString()));
|
lore.add(plugin.color(string).replace("%reason%", TL.MISSION_MISSION_ALL_COMPLETED.toString()));
|
||||||
}
|
}
|
||||||
@@ -152,7 +159,8 @@ public class MissionGUI implements FactionGUI {
|
|||||||
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem();
|
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem();
|
||||||
meta = start.getItemMeta();
|
meta = start.getItemMeta();
|
||||||
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = meta.getLore();
|
||||||
|
lore.clear();
|
||||||
for (String string : plugin.getConfig().getStringList("Randomization.Start-Item.Disallowed.Lore")) {
|
for (String string : plugin.getConfig().getStringList("Randomization.Start-Item.Disallowed.Lore")) {
|
||||||
lore.add(plugin.color(string).replace("%reason%", FactionsPlugin.getInstance().txt.parse(TL.MISSION_MISSION_MAX_ALLOWED.toString(), plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce"))));
|
lore.add(plugin.color(string).replace("%reason%", FactionsPlugin.getInstance().txt.parse(TL.MISSION_MISSION_MAX_ALLOWED.toString(), plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce"))));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.massivecraft.factions.shield;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
|
public class TimeFrame {
|
||||||
|
|
||||||
|
//each of these objs will be in 1 fac
|
||||||
|
|
||||||
|
private Faction faction;
|
||||||
|
private Enum startingTime;
|
||||||
|
private Enum endingTime;
|
||||||
|
|
||||||
|
private int currentMinutes; // this will be the variable for either the currentTime starting, or ending, or current in effect.
|
||||||
|
|
||||||
|
private boolean inEffect; // if the forcefield is in effect
|
||||||
|
private boolean starting; // pending starting countdown
|
||||||
|
private boolean ending; // pending ending countdown
|
||||||
|
|
||||||
|
private enum times {
|
||||||
|
twelveAM, oneAM, twoAM, threeAM, fourAM, fiveAM, sixAM, sevenAM, eightAM, nineAM, tenAM, elevenAM, twelvePM,
|
||||||
|
onePM, twoPM, threePM, fourPM, fivePM, sixPM, sevenPM, eightPM, ninePM, tenPM, elevenPM;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TimeFrame(Faction faction, Enum startingTime, Enum endingTime, boolean starting, boolean ending, boolean inEffect, int currentMinutes){
|
||||||
|
this.faction = faction;
|
||||||
|
this.startingTime = startingTime;
|
||||||
|
this.endingTime = endingTime;
|
||||||
|
this.starting = starting;
|
||||||
|
this.ending = ending;
|
||||||
|
this.inEffect = inEffect;
|
||||||
|
this.currentMinutes = currentMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEnding() {
|
||||||
|
return ending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInEffect() {
|
||||||
|
return inEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum getEndingTime() {
|
||||||
|
return endingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum getStartingTime() {
|
||||||
|
return startingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStarting() {
|
||||||
|
return starting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction() {
|
||||||
|
return faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentMinutes(int currentMinutes) {
|
||||||
|
this.currentMinutes = currentMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentMinutes() {
|
||||||
|
return currentMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnding(boolean ending) {
|
||||||
|
this.ending = ending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndingTime(Enum endingTime) {
|
||||||
|
this.endingTime = endingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingTime(Enum startingTime) {
|
||||||
|
this.startingTime = startingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFaction(Faction faction) {
|
||||||
|
this.faction = faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInEffect(boolean inEffect) {
|
||||||
|
this.inEffect = inEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarting(boolean starting) {
|
||||||
|
this.starting = starting;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.massivecraft.factions.shield;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
|
public class TimeFrameTask implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//remove tiem from the timeFrame
|
||||||
|
|
||||||
|
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||||
|
|
||||||
|
if (faction.getTimeFrame() != null){
|
||||||
|
TimeFrame timeFrame = faction.getTimeFrame();
|
||||||
|
|
||||||
|
if (timeFrame.isStarting() || timeFrame.isEnding() || timeFrame.isInEffect()){
|
||||||
|
//either starting, ending, or in effect, so we have to remove 1 minute interval from the currentTime
|
||||||
|
int newTime = Math.subtractExact(timeFrame.getCurrentMinutes(), 1);
|
||||||
|
if (newTime == 0){
|
||||||
|
//time is done, do functions...
|
||||||
|
if (timeFrame.isStarting() || timeFrame.isInEffect()){
|
||||||
|
if (timeFrame.isStarting()){
|
||||||
|
//it was starting, now set to inEffect
|
||||||
|
timeFrame.setStarting(false);
|
||||||
|
timeFrame.setInEffect(true);
|
||||||
|
}
|
||||||
|
//we don't need to check for inEffect because if it is, it'll just set the time back anyways...
|
||||||
|
timeFrame.setCurrentMinutes(720);
|
||||||
|
continue; // continue to the next faction
|
||||||
|
}else if (timeFrame.isEnding()){
|
||||||
|
//it was ending, now set inEffect to false, basically remove from the faction obj
|
||||||
|
timeFrame.setEnding(false);
|
||||||
|
timeFrame.setInEffect(false);
|
||||||
|
//remove from faction object
|
||||||
|
faction.setTimeFrame(null);
|
||||||
|
continue; // continue to the next faction
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timeFrame.setCurrentMinutes(newTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,9 +33,10 @@ public class Updater {
|
|||||||
lore.clear();
|
lore.clear();
|
||||||
lore.add("&4%reason%");
|
lore.add("&4%reason%");
|
||||||
conf.set("Randomization.Start-Item.Disallowed.Lore", lore);
|
conf.set("Randomization.Start-Item.Disallowed.Lore", lore);
|
||||||
conf.set("Randomization.Start-Item.Slot", 28);
|
conf.set("Randomization.Start-Item.Slot", 23);
|
||||||
conf.set("Config-Version", 1.1);
|
conf.set("Config-Version", 1.1);
|
||||||
currentVersion = 1.1;
|
version = 1.1;
|
||||||
|
|
||||||
}
|
}
|
||||||
//End with save + reload
|
//End with save + reload
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -817,7 +817,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
int factionBuffer = FactionsPlugin.getInstance().getConfig().getInt("hcf.buffer-zone", 0);
|
int factionBuffer = FactionsPlugin.getInstance().getConfig().getInt("hcf.buffer-zone", 0);
|
||||||
int worldBuffer = FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0);
|
int worldBuffer = FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0);
|
||||||
|
|
||||||
if (Conf.worldGuardChecking && Worldguard.getInstance().checkForRegionsInChunk(flocation) && !this.isAdminBypassing()) {
|
if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(flocation) && !this.isAdminBypassing()) {
|
||||||
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
||||||
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_PROTECTED.toString());
|
error = FactionsPlugin.getInstance().txt.parse(TL.CLAIM_PROTECTED.toString());
|
||||||
} else if (flocation.isOutsideWorldBorder(FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0))) {
|
} else if (flocation.isOutsideWorldBorder(FactionsPlugin.getInstance().getConfig().getInt("world-border.buffer", 0))) {
|
||||||
@@ -988,8 +988,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faction.isSystemFaction()) {
|
if (faction.isWilderness() || faction.isSafeZone() || faction.isWarZone()){
|
||||||
return CmdFly.checkBypassPerms(this, getPlayer(), faction);
|
return CmdFly.checkBypassPerms(this, this.getPlayer(), faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Access access = faction.getAccess(this, PermissableAction.FLY);
|
Access access = faction.getAccess(this, PermissableAction.FLY);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.massivecraft.factions.iface.RelationParticipator;
|
|||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.missions.Mission;
|
import com.massivecraft.factions.missions.Mission;
|
||||||
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
||||||
|
import com.massivecraft.factions.shield.TimeFrame;
|
||||||
import com.massivecraft.factions.struct.BanInfo;
|
import com.massivecraft.factions.struct.BanInfo;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
@@ -29,6 +30,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.sql.Time;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -93,6 +95,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
private String weeWooFormat;
|
private String weeWooFormat;
|
||||||
private String guildId;
|
private String guildId;
|
||||||
private String memberRoleId;
|
private String memberRoleId;
|
||||||
|
private TimeFrame timeFrame;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@@ -128,6 +131,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.notifyFormat = "@everyone, check %type%";
|
this.notifyFormat = "@everyone, check %type%";
|
||||||
this.weeWooFormat = "@everyone, we're being raided! Get online!";
|
this.weeWooFormat = "@everyone, we're being raided! Get online!";
|
||||||
this.memberRoleId = null;
|
this.memberRoleId = null;
|
||||||
|
this.timeFrame = null;
|
||||||
resetPerms(); // Reset on new Faction so it has default values.
|
resetPerms(); // Reset on new Faction so it has default values.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,6 +164,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.checks = new ConcurrentHashMap<>();
|
this.checks = new ConcurrentHashMap<>();
|
||||||
this.playerWallCheckCount = new ConcurrentHashMap<>();
|
this.playerWallCheckCount = new ConcurrentHashMap<>();
|
||||||
this.playerBufferCheckCount = new ConcurrentHashMap<>();
|
this.playerBufferCheckCount = new ConcurrentHashMap<>();
|
||||||
|
this.timeFrame = null;
|
||||||
resetPerms(); // Reset on new Faction so it has default values.
|
resetPerms(); // Reset on new Faction so it has default values.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,13 +870,22 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Access getAccess(FPlayer player, PermissableAction permissableAction) {
|
public Access getAccess(FPlayer player, PermissableAction permissableAction) {
|
||||||
if (player == null || permissableAction == null) return Access.UNDEFINED;
|
if (player == null || permissableAction == null) {
|
||||||
|
return Access.UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Permissable perm;
|
||||||
|
|
||||||
Permissable perm = player.getFaction() == this ? player.getRole() : player.getFaction().getRelationTo(this);
|
if (player.getFaction() == this) {
|
||||||
|
perm = player.getRole();
|
||||||
|
} else {
|
||||||
|
perm = player.getFaction().getRelationTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
Map<PermissableAction, Access> accessMap = permissions.get(perm);
|
Map<PermissableAction, Access> accessMap = permissions.get(perm);
|
||||||
if (accessMap != null && accessMap.containsKey(permissableAction)) return accessMap.get(permissableAction);
|
if (accessMap != null && accessMap.containsKey(permissableAction)) {
|
||||||
|
return accessMap.get(permissableAction);
|
||||||
|
}
|
||||||
|
|
||||||
return Access.UNDEFINED;
|
return Access.UNDEFINED;
|
||||||
}
|
}
|
||||||
@@ -886,6 +900,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
|
|
||||||
public void resetPerms() {
|
public void resetPerms() {
|
||||||
FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag);
|
FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag);
|
||||||
|
|
||||||
permissions.clear();
|
permissions.clear();
|
||||||
|
|
||||||
// First populate a map with undefined as the permission for each action.
|
// First populate a map with undefined as the permission for each action.
|
||||||
@@ -1494,4 +1509,12 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
public Set<FLocation> getAllClaims() {
|
public Set<FLocation> getAllClaims() {
|
||||||
return Board.getInstance().getAllClaims(this);
|
return Board.getInstance().getAllClaims(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TimeFrame getTimeFrame(){
|
||||||
|
return this.timeFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeFrame(TimeFrame timeFrame){
|
||||||
|
this.timeFrame = timeFrame;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,18 +103,6 @@ public class Persist {
|
|||||||
return DiscUtil.writeCatch(file, p.gson.toJson(instance), false);
|
return DiscUtil.writeCatch(file, p.gson.toJson(instance), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveSync(Object instance) {
|
|
||||||
return saveSync(instance, getFile(instance));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean saveSync(Object instance, String name) {
|
|
||||||
return saveSync(instance, getFile(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean saveSync(Object instance, File file) {
|
|
||||||
return DiscUtil.writeCatch(file, p.gson.toJson(instance), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LOAD BY CLASS
|
// LOAD BY CLASS
|
||||||
|
|
||||||
public <T> T load(Class<T> clazz) {
|
public <T> T load(Class<T> clazz) {
|
||||||
|
|||||||
@@ -56,12 +56,6 @@ public enum TL {
|
|||||||
ACTIONS_MUSTBE("Youmust be {role} to {action}."),
|
ACTIONS_MUSTBE("Youmust be {role} to {action}."),
|
||||||
ACTIONS_NOSAMEROLE("{role} can't control each other..."),
|
ACTIONS_NOSAMEROLE("{role} can't control each other..."),
|
||||||
ACTIONS_NOFACTION("You are not member of any faction."),
|
ACTIONS_NOFACTION("You are not member of any faction."),
|
||||||
|
|
||||||
ACTION_DENIED_SAFEZONE("You can't use %1$s in safezone!"),
|
|
||||||
ACTION_DENIED_WARZONE("You can't use %1$s in warzone!"),
|
|
||||||
ACTION_DENIED_WILDERNESS("You can't use %1$s in wilderness!"),
|
|
||||||
ACTION_DENIED_OTHER("%1$s does not allow you to %2$s here!"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command translations
|
* Command translations
|
||||||
*/
|
*/
|
||||||
@@ -888,7 +882,7 @@ public enum TL {
|
|||||||
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
|
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
|
||||||
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
|
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
|
||||||
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
|
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
|
||||||
COMMAND_TNT_AMOUNT("&cYour faction has {amount}/{maxAmount} tnt in the tnt bank."),
|
COMMAND_TNT_AMOUNT("&cYour faction has %1$s tnt in the tnt bank."),
|
||||||
COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"),
|
COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"),
|
||||||
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
|
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
|
||||||
COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."),
|
COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."),
|
||||||
@@ -1004,7 +998,6 @@ public enum TL {
|
|||||||
GENERIC_YOU("you"),
|
GENERIC_YOU("you"),
|
||||||
GENERIC_YOURFACTION("your faction"),
|
GENERIC_YOURFACTION("your faction"),
|
||||||
GENERIC_NOPERMISSION("You don't have permission to %1$s."),
|
GENERIC_NOPERMISSION("You don't have permission to %1$s."),
|
||||||
GENERIC_ACTION_NOPERMISSION("You don't have permission to use %1$s"),
|
|
||||||
GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."),
|
GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."),
|
||||||
GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit
|
GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit
|
||||||
GENERIC_NOPLAYERMATCH("No player match found for \"<plugin>%1$s\"."),
|
GENERIC_NOPLAYERMATCH("No player match found for \"<plugin>%1$s\"."),
|
||||||
@@ -1039,7 +1032,7 @@ public enum TL {
|
|||||||
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
|
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
|
||||||
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
|
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
|
||||||
|
|
||||||
// MISSION_CREATED_COOLDOWN("&c&l[!] &7Due to your immediate faction creation, you may not start missions for &b%1$s minutes&7!"),
|
|
||||||
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
||||||
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
|
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
|
||||||
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
|
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ fperm-gui:
|
|||||||
- ''
|
- ''
|
||||||
- '&4&l* &cStatus: &f{action-access-color}{action-access}'
|
- '&4&l* &cStatus: &f{action-access-color}{action-access}'
|
||||||
- ''
|
- ''
|
||||||
- '&2&l* &aLeft click to &a&lAllow&a.'
|
- '&2&l* &aLeft click to &alAllow&a.'
|
||||||
- '&4&l* &cRight click to &c&lDeny&c.'
|
- '&4&l* &cRight click to &c&lDeny&c.'
|
||||||
- '&8&l* &7Middle click to &7&lUndefine&7.'
|
- '&8&l* &7Middle click to &7&lUndefine&7.'
|
||||||
# Back item will be take you to the previous GUI
|
# Back item will be take you to the previous GUI
|
||||||
@@ -748,7 +748,7 @@ f-points:
|
|||||||
# | Faction Missions | #
|
# | Faction Missions | #
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
############################################################
|
############################################################
|
||||||
MissionGUISize: 4
|
MissionGUISize: 3
|
||||||
Missions-Enabled: true
|
Missions-Enabled: true
|
||||||
Missions-GUI-Title: '&8&lFaction Missions'
|
Missions-GUI-Title: '&8&lFaction Missions'
|
||||||
MaximumMissionsAllowedAtOnce: 1
|
MaximumMissionsAllowedAtOnce: 1
|
||||||
@@ -767,15 +767,14 @@ Randomization:
|
|||||||
Material: GRAY_STAINED_GLASS_PANE
|
Material: GRAY_STAINED_GLASS_PANE
|
||||||
Lore:
|
Lore:
|
||||||
- '&4%reason%'
|
- '&4%reason%'
|
||||||
# in default configuration you will need to change the GUI size to 4 and for best results change the fillitem rows to 4 as well.
|
Slot: 23
|
||||||
Slot: 31
|
|
||||||
DenyMissionsMoreThenOnce: true #this setting to true, means that if they complete a mission they cannot redo the same mission
|
DenyMissionsMoreThenOnce: true #this setting to true, means that if they complete a mission they cannot redo the same mission
|
||||||
|
|
||||||
#Mission Types: KILL, MINE, PLACE, FISH, TAME, ENCHANT, CONSUME
|
#Mission Types: KILL, MINE, PLACE, FISH, TAME, ENCHANT, CONSUME
|
||||||
Missions:
|
Missions:
|
||||||
FillItem:
|
FillItem:
|
||||||
Material: BLACK_STAINED_GLASS_PANE
|
Material: BLACK_STAINED_GLASS_PANE
|
||||||
Rows: 4
|
Rows: 3
|
||||||
sugarcane:
|
sugarcane:
|
||||||
Slot: 11
|
Slot: 11
|
||||||
Material: "SUGAR_CANE"
|
Material: "SUGAR_CANE"
|
||||||
@@ -1331,6 +1330,7 @@ Tntfill:
|
|||||||
max-radius: 32
|
max-radius: 32
|
||||||
max-amount: 64
|
max-amount: 64
|
||||||
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | Big List of variables | #
|
# | Big List of variables | #
|
||||||
|
|||||||
Reference in New Issue
Block a user