Multiple NullPointer Fixes With Container Permissions and Chat Fixed

This commit is contained in:
Joshua Murphy 2018-11-21 05:25:45 -05:00
parent eee6a014e2
commit 8af272cfdf
4 changed files with 169 additions and 154 deletions

View File

@ -181,7 +181,7 @@ public class FactionsChatListener implements Listener {
if (Conf.chatTagRelationColored) {
// Messages are sent to players individually
// This still leaves a chance for other plugins to pick it up
event.getRecipients().clear();
event.setCancelled(true);
for (Player listeningPlayer : event.getRecipients()) {
FPlayer you = FPlayers.getInstance().getByPlayer(listeningPlayer);

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.listeners;
import com.massivecraft.factions.*;
import com.massivecraft.factions.cmd.CmdFly;
import com.massivecraft.factions.cmd.CmdSeeChunk;
@ -163,7 +162,6 @@ public class FactionsPlayerListener implements Listener {
return true;
}
@SuppressWarnings("deprecation")
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck) {
if (Conf.playersWhoBypassAllProtection.contains(player.getName())) {
return true;
@ -181,6 +179,7 @@ public class FactionsPlayerListener implements Listener {
Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction);
// no door/chest/whatever protection in wilderness, war zones, or safe zones
if (!otherFaction.isNormal()) {
return true;
@ -237,6 +236,14 @@ public class FactionsPlayerListener implements Listener {
case CHEST:
case ENDER_CHEST:
case TRAPPED_CHEST:
case DISPENSER:
case ENCHANTING_TABLE:
case DROPPER:
case FURNACE:
case HOPPER:
case ANVIL:
case CHIPPED_ANVIL:
case DAMAGED_ANVIL:
action = PermissableAction.CONTAINER;
break;
default:
@ -271,6 +278,14 @@ public class FactionsPlayerListener implements Listener {
case CHEST:
case ENDER_CHEST:
case TRAPPED_CHEST:
case DISPENSER:
case ENCHANTING_TABLE:
case DROPPER:
case FURNACE:
case HOPPER:
case ANVIL:
case CHIPPED_ANVIL:
case DAMAGED_ANVIL:
action = PermissableAction.CONTAINER;
break;
default:
@ -915,13 +930,13 @@ public class FactionsPlayerListener implements Listener {
// returns the current attempt count
public int increment() {
long now = System.currentTimeMillis();
if (now > lastAttempt + 2000) {
long Now = System.currentTimeMillis();
if (Now > lastAttempt + 2000) {
attempts = 1;
} else {
attempts++;
}
lastAttempt = now;
lastAttempt = Now;
return attempts;
}
}

View File

@ -262,7 +262,7 @@ public enum MultiversionMaterials {
EMERALD_ORE("EMERALD_ORE", 0),
ENCHANTED_BOOK("ENCHANTED_BOOK", 0),
ENCHANTED_GOLDEN_APPLE("GOLDEN_APPLE", 1),
ENCHANTING_TABLE("ENCHANTMENT_TABLE", 0),
ENCHANTING_TABLE("ENCHANTING_TABLE", 0),
ENDERMAN_SPAWN_EGG("MONSTER_EGG", 0),
ENDERMITE_SPAWN_EGG("MONSTER_EGG", 0),
ENDER_CHEST("ENDER_CHEST", 0),

View File

@ -351,7 +351,7 @@ help:
- '&e/f top &8- &7View the richest factions.'
- '&e/f map &8- &7Map of the surrounding area, click chunks to claim.'
- '&e/f sethome &8- &7Set your faction home.'
- '&e/f home &8- &7Set your faction home.'
- '&e/f home &8- &7Go to your faction home.'
- '&e/f title &f<playername> <title> &8- &7Set a player''s title, color codes supported.'
- '&e/f ban &8- &7Ban a member from your faction.'
- '&e/f unban &8- &7Unban a member from your faction.'