mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Fix some command permissions
- Trident material has an ID - Removed boolean pay-in-creative from generalConfig and replaced to jobs.paycreative permission. https://www.spigotmc.org/threads/jobs-reborn.50989/page-232#post-3242807
This commit is contained in:
parent
e52c4fa43b
commit
221ef37ea3
@ -1453,7 +1453,7 @@ public class ItemManager {
|
||||
TORCH(50, 0, 6063, "Torch"),
|
||||
TOTEM_OF_UNDYING(449, 0, 10139, "Totem Of Undying"),
|
||||
TRAPPED_CHEST(146, 0, 18970, "Trapped Chest"),
|
||||
TRIDENT(-1, -1, 7534, "Trident"),
|
||||
TRIDENT(455, 0, 7534, "Trident"),
|
||||
TRIPWIRE(132, 0, 8810, "Tripwire"),
|
||||
TRIPWIRE_HOOK(131, 0, 8130, "Tripwire Hook"),
|
||||
TROPICAL_FISH(349, 2, 24879, "Tropical Fish"),
|
||||
|
@ -1276,28 +1276,22 @@ public class Jobs extends JavaPlugin {
|
||||
return smanager;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(Object sender, String perm, boolean inform) {
|
||||
public static boolean hasPermission(Object sender, String perm, boolean rawEnable) {
|
||||
if (sender instanceof Player) {
|
||||
if (((Player) sender).hasPermission(perm))
|
||||
return true;
|
||||
if (!inform)
|
||||
if (!rawEnable) {
|
||||
((Player) sender).sendMessage(lManager.getMessage("general.error.permission"));
|
||||
return false;
|
||||
}
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(lManager.getMessage("general.error.permission"), "&2" + perm);
|
||||
rm.show((Player) sender);
|
||||
sendMessage(Bukkit.getServer().getConsoleSender(), lManager.getMessage("general.error.permission"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void sendMessage(Object sender, String msg) {
|
||||
if (sender instanceof Player)
|
||||
((Player) sender).sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||
else
|
||||
((CommandSender) sender).sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||
}
|
||||
|
||||
public void ShowPagination(CommandSender sender, int pageCount, int CurrentPage, String cmd) {
|
||||
ShowPagination(sender, pageCount, CurrentPage, cmd, null);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class MythicMobs2Listener implements Listener {
|
||||
if (pDamager == null)
|
||||
return;
|
||||
// check if in creative
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
|
||||
|
@ -52,7 +52,7 @@ public class MythicMobs4Listener implements Listener {
|
||||
if (pDamager == null)
|
||||
return;
|
||||
// check if in creative
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
|
||||
|
@ -20,7 +20,6 @@ import java.util.Map.Entry;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -93,9 +92,8 @@ public class JobsCommands implements CommandExecutor {
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.add(Jobs.getLanguage().getMessage("general.error.permission"), "&2" + label + ".command." + cmd);
|
||||
rm.show(sender);
|
||||
Jobs.sendMessage(Bukkit.getServer().getConsoleSender(), Jobs.getLanguage().getMessage("general.error.permission"));
|
||||
} else
|
||||
Jobs.sendMessage(sender, Jobs.getLanguage().getMessage("general.error.permission"));
|
||||
}
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@ public class blockinfo implements Cmd {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
if (!Jobs.hasPermission(player, "jobs.command.blockinfo", true))
|
||||
return true;
|
||||
|
||||
Block block = Util.getTargetBlock(player, 15);
|
||||
|
||||
|
@ -29,21 +29,21 @@ public class bonus implements Cmd {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
if (!Jobs.hasPermission(player, "jobs.command.bonus", true))
|
||||
return true;
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
||||
if (jPlayer == null)
|
||||
return false;
|
||||
|
||||
Jobs.getPlayerManager().updateOldItems(player);
|
||||
|
||||
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job, true, true);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
||||
|
@ -16,11 +16,12 @@ public class clearownership implements Cmd {
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
JobsPlayer jPlayer = null;
|
||||
if (args.length >= 1) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.clearownership", true)) {
|
||||
return true;
|
||||
}
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.clearownership", true))
|
||||
return true;
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (sender instanceof Player) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.clearownership", true))
|
||||
return true;
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
}
|
||||
|
||||
|
@ -22,18 +22,20 @@ public class demote implements Cmd {
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!Jobs.hasPermission(jPlayer.getPlayer(), "jobs.command.demote", true))
|
||||
return true;
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// check if player already has the job
|
||||
if (jPlayer.isInJob(job)) {
|
||||
@ -51,7 +53,7 @@ public class demote implements Cmd {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -20,18 +20,20 @@ public class employ implements Cmd {
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Jobs.hasPermission(jPlayer.getPlayer(), "jobs.command.employ", true))
|
||||
return true;
|
||||
|
||||
Job job = Jobs.getJob(args[1]);
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (jPlayer.isInJob(job)) {
|
||||
// already in job message
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
|
||||
|
@ -59,12 +59,14 @@ public class exp implements Cmd {
|
||||
return false;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(playerName);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Jobs.hasPermission(jPlayer.getPlayer(), "jobs.command.exp", true))
|
||||
return true;
|
||||
|
||||
if (job == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
|
@ -49,7 +49,6 @@ public class GeneralConfigManager {
|
||||
protected boolean economyAsync;
|
||||
protected boolean isBroadcastingSkillups;
|
||||
protected boolean isBroadcastingLevelups;
|
||||
protected boolean payInCreative;
|
||||
protected boolean payExploringWhenFlying;
|
||||
protected boolean addXpPlayer;
|
||||
protected boolean hideJobsWithoutPermission;
|
||||
@ -223,15 +222,6 @@ public class GeneralConfigManager {
|
||||
return isBroadcastingLevelups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that tells if the player should be paid while in creative
|
||||
* @return true - pay in creative
|
||||
* @return false - do not pay in creative
|
||||
*/
|
||||
public synchronized boolean payInCreative() {
|
||||
return payInCreative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that tells if the player should be paid while exploring and flying
|
||||
* @return true - pay
|
||||
@ -539,9 +529,6 @@ public class GeneralConfigManager {
|
||||
"Use jobs.nearspawner.[amount] to define multiplayer. Example jobs.nearspawner.-0.5 will pay half of payment, jobs.nearspawner.-1 will not pay at all");
|
||||
payNearSpawner = c.get("enable-pay-near-spawner", false);
|
||||
|
||||
c.getW().addComment("enable-pay-creative", "Option to allow payment to be made in creative mode");
|
||||
payInCreative = c.get("enable-pay-creative", false);
|
||||
|
||||
c.getW().addComment("enable-pay-for-exploring-when-flying", "Option to allow payment to be made for exploring when player flies");
|
||||
payExploringWhenFlying = c.get("enable-pay-for-exploring-when-flying", false);
|
||||
|
||||
|
@ -22,10 +22,7 @@ public class RestrictedAreaManager {
|
||||
|
||||
protected HashMap<String, RestrictedArea> restrictedAreas = new HashMap<>();
|
||||
|
||||
private Jobs plugin;
|
||||
|
||||
public RestrictedAreaManager(Jobs plugin) {
|
||||
this.plugin = plugin;
|
||||
public RestrictedAreaManager() {
|
||||
}
|
||||
|
||||
public boolean isExist(String name) {
|
||||
@ -62,7 +59,7 @@ public class RestrictedAreaManager {
|
||||
}
|
||||
|
||||
private void save() {
|
||||
File f = new File(plugin.getDataFolder(), "restrictedAreas.yml");
|
||||
File f = new File(Jobs.getFolder(), "restrictedAreas.yml");
|
||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
||||
conf.options().indent(2);
|
||||
conf.options().copyDefaults(true);
|
||||
@ -178,7 +175,7 @@ public class RestrictedAreaManager {
|
||||
*/
|
||||
public synchronized void load() {
|
||||
this.restrictedAreas.clear();
|
||||
File f = new File(plugin.getDataFolder(), "restrictedAreas.yml");
|
||||
File f = new File(Jobs.getFolder(), "restrictedAreas.yml");
|
||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
||||
conf.options().indent(2);
|
||||
conf.options().copyDefaults(true);
|
||||
|
@ -170,7 +170,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
@ -228,7 +228,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -288,7 +288,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -363,15 +363,15 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode() == GameMode.CREATIVE && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode() == GameMode.CREATIVE && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
if (block.getType() == Material.FURNACE && block.hasMetadata(furnaceOwnerMetadata))
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
if (block.getType() == Material.BREWING_STAND && block.hasMetadata(brewingOwnerMetadata))
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND) && block.hasMetadata(brewingOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeBrewing(block);
|
||||
|
||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
||||
@ -433,7 +433,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -457,7 +457,7 @@ public class JobsPaymentListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -495,7 +495,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (player == null || !player.isOnline())
|
||||
return;
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -556,7 +556,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
@ -779,7 +779,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
@ -816,7 +816,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
@ -1057,7 +1057,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (pDamager == null)
|
||||
return;
|
||||
// check if in creative
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
|
||||
@ -1125,7 +1125,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1155,7 +1155,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1193,7 +1193,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (player == null || !player.isOnline())
|
||||
return;
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1227,7 +1227,7 @@ public class JobsPaymentListener implements Listener {
|
||||
Player pDamager = (Player) e.getDamager();
|
||||
|
||||
// check if in creative
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
|
||||
@ -1296,7 +1296,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
if (player != null && closest < 30.0) {
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1335,7 +1335,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1388,7 +1388,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1402,10 +1402,10 @@ public class JobsPaymentListener implements Listener {
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
if (block.getType() == Material.FURNACE && block.hasMetadata(furnaceOwnerMetadata))
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
|
||||
if (block.getType() == Material.BREWING_STAND && block.hasMetadata(brewingOwnerMetadata))
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND) && block.hasMetadata(brewingOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeBrewing(block);
|
||||
|
||||
if (Jobs.getGCManager().useBlockProtection)
|
||||
@ -1433,7 +1433,6 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) || CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
|
||||
|
||||
ownershipFeedback done = FurnaceBrewingHandling.registerFurnaces(event.getPlayer(), block);
|
||||
if (done.equals(ownershipFeedback.tooMany)) {
|
||||
boolean report = false;
|
||||
@ -1458,8 +1457,7 @@ public class JobsPaymentListener implements Listener {
|
||||
"[current]", jPlayer.getFurnaceCount(),
|
||||
"[max]", jPlayer.getMaxFurnacesAllowed() == 0 ? "-" : jPlayer.getMaxFurnacesAllowed()));
|
||||
}
|
||||
} else if (block.getType() == Material.BREWING_STAND) {
|
||||
|
||||
} else if (CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND)) {
|
||||
ownershipFeedback done = FurnaceBrewingHandling.registerBrewingStand(event.getPlayer(), block);
|
||||
if (done.equals(ownershipFeedback.tooMany)) {
|
||||
boolean report = false;
|
||||
@ -1504,7 +1502,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (p.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (p.getGameMode().equals(GameMode.CREATIVE) && !p.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(p, p.getLocation().getWorld().getName()))
|
||||
@ -1546,7 +1544,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
|
@ -51,7 +51,7 @@ public class McMMOlistener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative"))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
@ -7,7 +7,6 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -186,9 +185,7 @@ public class FurnaceBrewingHandling {
|
||||
}
|
||||
|
||||
public static boolean removeFurnace(Block block) {
|
||||
|
||||
UUID uuid = null;
|
||||
|
||||
if (block.hasMetadata(JobsPaymentListener.furnaceOwnerMetadata)) {
|
||||
List<MetadataValue> data = block.getMetadata(JobsPaymentListener.furnaceOwnerMetadata);
|
||||
if (!data.isEmpty()) {
|
||||
@ -203,6 +200,7 @@ public class FurnaceBrewingHandling {
|
||||
if (ls == null)
|
||||
return true;
|
||||
|
||||
// TODO Fix error when removing the furnaces from the file, but removing all
|
||||
for (blockLoc one : ls) {
|
||||
if (!one.getLocation().equals(block.getLocation()))
|
||||
continue;
|
||||
@ -211,11 +209,9 @@ public class FurnaceBrewingHandling {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean removeBrewing(Block block) {
|
||||
|
||||
UUID uuid = null;
|
||||
if (block.hasMetadata(JobsPaymentListener.brewingOwnerMetadata)) {
|
||||
List<MetadataValue> data = block.getMetadata(JobsPaymentListener.brewingOwnerMetadata);
|
||||
@ -230,6 +226,8 @@ public class FurnaceBrewingHandling {
|
||||
List<blockLoc> ls = brewingMap.get(uuid);
|
||||
if (ls == null)
|
||||
return true;
|
||||
|
||||
// TODO Fix error when removing the brewers from the file, but removing all
|
||||
for (blockLoc one : ls) {
|
||||
if (!one.getLocation().equals(block.getLocation()))
|
||||
continue;
|
||||
@ -237,9 +235,7 @@ public class FurnaceBrewingHandling {
|
||||
ls.remove(one);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public enum ownershipFeedback {
|
||||
@ -248,9 +244,8 @@ public class FurnaceBrewingHandling {
|
||||
|
||||
public static ownershipFeedback registerFurnaces(Player player, Block block) {
|
||||
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE))
|
||||
return ownershipFeedback.invalid;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
||||
@ -294,9 +289,8 @@ public class FurnaceBrewingHandling {
|
||||
|
||||
public static ownershipFeedback registerBrewingStand(Player player, Block block) {
|
||||
|
||||
if (block.getType() != Material.BREWING_STAND) {
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND))
|
||||
return ownershipFeedback.invalid;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
||||
@ -346,9 +340,8 @@ public class FurnaceBrewingHandling {
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE))
|
||||
continue;
|
||||
}
|
||||
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());
|
||||
}
|
||||
return ls.size();
|
||||
@ -363,9 +356,8 @@ public class FurnaceBrewingHandling {
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
if (block.getType() != Material.BREWING_STAND) {
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND))
|
||||
continue;
|
||||
}
|
||||
block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
|
||||
}
|
||||
return ls.size();
|
||||
|
@ -46,6 +46,7 @@ permissions:
|
||||
jobs.command.fire: true
|
||||
jobs.command.fireall: true
|
||||
jobs.command.employ: true
|
||||
jobs.command.bonus: true
|
||||
jobs.command.edititembonus: true
|
||||
jobs.command.promote: true
|
||||
jobs.command.points: true
|
||||
@ -65,6 +66,8 @@ permissions:
|
||||
jobs.command.fixnames: true
|
||||
jobs.command.signupdate: true
|
||||
jobs.command.moneyboost: true
|
||||
jobs.command.exp: true
|
||||
jobs.command.clearownership: true
|
||||
jobs.command.expboost: true
|
||||
jobs.command.iteminfo: true
|
||||
jobs.command.blockinfo: true
|
||||
@ -194,3 +197,9 @@ permissions:
|
||||
jobs.command.edititembonus:
|
||||
description: Grants access to the edititembonus command
|
||||
default: op
|
||||
jobs.area.add:
|
||||
description: Grants access to the area add command
|
||||
default: false
|
||||
jobs.area.remove:
|
||||
description: Grants access to the area remove command
|
||||
default: false
|
||||
|
Loading…
Reference in New Issue
Block a user