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

@ -114,20 +114,20 @@ tooltips:
# Use &0-9a-f for colors and include messages in "quotes"
scoreboard:
# send faction change message as well when scoreboard is up?
# send faction change message as well when scoreboard is up?
also-send-chat: true
# How long do we want scoreboards to stay if set temporarily.
# How long do we want scoreboards to stay if set temporarily.
expiration: 7
# FInfo scoreboard is displayed when a player walks into a new Faction's territory.
# Scoreboard disappears after <expiration> seconds.
# Things to be replaced in this:
# {power} - faction's power. {chunks} - total claimed chunks. {members} - total members.
# {online} - online members. {leader} - faction's leader. {open} - shows either true or false if open.
# {raidable} - true if the faction can be claimed over, otherwise false.
# {warps} - the number of warps that a faction has set.
# The title of the scoreboard will be the Faction's tag and colored according to the relation with the player's Faction.
# Commenting this section out will cause the info to appear in chat as the plugin originally did.
# FInfo scoreboard is displayed when a player walks into a new Faction's territory.
# Scoreboard disappears after <expiration> seconds.
# Things to be replaced in this:
# {power} - faction's power. {chunks} - total claimed chunks. {members} - total members.
# {online} - online members. {leader} - faction's leader. {open} - shows either true or false if open.
# {raidable} - true if the faction can be claimed over, otherwise false.
# {warps} - the number of warps that a faction has set.
# The title of the scoreboard will be the Faction's tag and colored according to the relation with the player's Faction.
# Commenting this section out will cause the info to appear in chat as the plugin originally did.
finfo-enabled: false
# SUPPORTS PLACEHOLDERS
@ -141,12 +141,12 @@ scoreboard:
- "&bTerritory"
- "{chunks}"
# Default board that will always show up if a player wants it to.
# This can show any arbitrary text or you can use a lot of variables to replace things.
# Replace {name} - player's name. {faction} - player's faction title, factionless if none.
# {totalOnline} - total players on the server. {balance} - player's balance.
# {maxPower} - player's max power.
# {powerBoost} - player's powerboost.
# Default board that will always show up if a player wants it to.
# This can show any arbitrary text or you can use a lot of variables to replace things.
# Replace {name} - player's name. {faction} - player's faction title, factionless if none.
# {totalOnline} - total players on the server. {balance} - player's balance.
# {maxPower} - player's max power.
# {powerBoost} - player's powerboost.
default-enabled: false # Default to false to keep original functionality.
default-title: "&cSavageFactions" # Can use any of the values from above but this won't update once it's set (so don't set {balance}).
@ -156,7 +156,7 @@ scoreboard:
# The scoreboard needs to be enabled for this to work.
default-prefixes: true
# SUPPORTS PLACEHOLDERS
# SUPPORTS PLACEHOLDERS
default:
- "&7&m--------------------------"
@ -276,25 +276,25 @@ hcf:
# SUPPORTS PLACEHOLDERS
show:
# First line can be {header} for default header, or any string (we recommend &m for smooth lines ;plugin)
- '&8&m--------------&7 &8<&e{faction}&8> &8&m--------------'
- '&6 * &eOwner &7{leader}'
- '&6 * &eDescription &7{description}'
- '&6 * &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}'
- '&6 * &eFounded &7{create-date}'
- '&6 * &eBalance &f{faction-balance}'
- '&6 * &eAllies &c{allies-list}'
- '&6 * &eEnemies &c{enemies-list}'
- '&6 * &eOnline Members &8(&7{online}/{members}&8) &7{online-list}'
- '&6 * &eOffline Members &8(&7{offline}/{members}&8) &7{offline-list}'
- '&6 * &eBans &7{faction-bancount}'
- '&8&m----------------------------------------'
- '&8&m--------------&7 &8<&e{faction}&8> &8&m--------------'
- '&6 * &eOwner &7{leader}'
- '&6 * &eDescription &7{description}'
- '&6 * &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}'
- '&6 * &eFounded &7{create-date}'
- '&6 * &eBalance &f{faction-balance}'
- '&6 * &eAllies &c{allies-list}'
- '&6 * &eEnemies &c{enemies-list}'
- '&6 * &eOnline Members &8(&7{online}/{members}&8) &7{online-list}'
- '&6 * &eOffline Members &8(&7{offline}/{members}&8) &7{offline-list}'
- '&6 * &eBans &7{faction-bancount}'
- '&8&m----------------------------------------'
# For a /f show that does not display fancy messages that are essentially empty, use minimal-show
minimal-show: false
# Factions that should be exempt from /f show, case sensitive, useful for a
# serverteam faction, since the command shows vanished players otherwise
show-exempt:
- Wilderness
- Wilderness
# THIS IS FOR /f map tool tips.
@ -303,13 +303,13 @@ show-exempt:
# Lines that arent defined wont be sent (home not set, faction not peaceful / permanent, dtr freeze)
map:
# First line can be {header} for default header, or any string (we recommend &m for smooth lines ;plugin)
- '&6* &eFaction &7{faction}'
- '&6* &eOwner &7{leader}'
- '&6* &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}'
- '&6* &eAllies &c{allies-list}'
- '&6* &eEnemies &c{enemies-list}'
- '&6* &eOnline Members &8(&7{online}/{members}&8) {online-list}'
- '&6* &eOffline Members &7{offline-list}'
- '&6* &eFaction &7{faction}'
- '&6* &eOwner &7{leader}'
- '&6* &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}'
- '&6* &eAllies &c{allies-list}'
- '&6* &eEnemies &c{enemies-list}'
- '&6* &eOnline Members &8(&7{online}/{members}&8) {online-list}'
- '&6* &eOffline Members &7{offline-list}'
############################################################
# +------------------------------------------------------+ #
@ -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.'
@ -630,11 +630,11 @@ fperm-gui:
name: ' '
lore:
-
############################################################
# +------------------------------------------------------+ #
# | Faction Warp GUI | #
# +------------------------------------------------------+ #
############################################################
############################################################
# +------------------------------------------------------+ #
# | Faction Warp GUI | #
# +------------------------------------------------------+ #
############################################################
fwarp-gui:
name: "Faction Warps"
@ -692,11 +692,11 @@ fwarp-gui:
name: ' '
lore:
-
############################################################
# +------------------------------------------------------+ #
# | Faction Rules | #
# +------------------------------------------------------+ #
############################################################
############################################################
# +------------------------------------------------------+ #
# | Faction Rules | #
# +------------------------------------------------------+ #
############################################################
frules:
Enabled: true
default-rules: