Addressed Issue: #90 & Added Configurable removePlayerDataWhenBanned message

This commit is contained in:
Driftay 2020-04-13 15:20:46 -04:00
parent cf075c270e
commit 9707226762
4 changed files with 8 additions and 12 deletions

View File

@ -98,6 +98,7 @@ public class Conf {
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
public static int autoLeaveRoutineMaxMillisecondsPerTick = 5; // 1 server tick is roughly 50ms, so default max 10% of a tick
public static boolean removePlayerDataWhenBanned = true;
public static String removePlayerDataWhenBannedReason = "Banned by admin.";
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
public static boolean worldGuardChecking = false;
public static boolean worldGuardBuildPriority = false;

View File

@ -191,7 +191,7 @@ public class FactionsBlockListener implements Listener {
event.setCancelled(true);
return;
}
if (to.isNormal()) {
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
return;

View File

@ -47,9 +47,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.NumberConversions;
import java.util.*;
import java.util.logging.Level;
@ -455,7 +453,6 @@ public class FactionsPlayerListener implements Listener {
case CHIPPED_ANVIL:
case DAMAGED_ANVIL:
case BREWING_STAND:
return PermissableAction.CONTAINER;
default:
return null;
@ -843,15 +840,12 @@ public class FactionsPlayerListener implements Listener {
@EventHandler
public void onInventorySee(InventoryClickEvent e) {
if (e.getCurrentItem() == null)
return;
if (!e.getView().getTitle().endsWith("'s Inventory"))
return;
if (e.getCurrentItem() == null) return;
if (!e.getView().getTitle().endsWith("'s Inventory")) return;
e.setCancelled(true);
}
@EventHandler
public void onPlayerBoneMeal(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
@ -971,7 +965,7 @@ public class FactionsPlayerListener implements Listener {
if (badGuy == null) return;
// 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(Conf.removePlayerDataWhenBannedReason)) {
if (badGuy.getRole() == Role.LEADER) badGuy.getFaction().promoteNewLeader();

View File

@ -40,7 +40,8 @@ public class FactionWarpsFrame {
int count = 0;
for (int x = 0; x <= gui.getRows() * 9 - 1; ++x)
GUIItems.add(new GuiItem(buildDummyItem(), e -> e.setCancelled(true)));
slots.forEach(slot -> GUIItems.set(slot, new GuiItem(XMaterial.AIR.parseItem())));
//We comment this out for now so it does not interfere with item placement when no warps are set
//slots.forEach(slot -> GUIItems.set(slot, new GuiItem(XMaterial.AIR.parseItem())));
for (final Map.Entry<String, LazyLocation> warp : fplayer.getFaction().getWarps().entrySet()) {
if (slots.size() < fplayer.getFaction().getWarps().entrySet().size()) {
slots.add(slots.get(slots.size() - 1) + 1);