Fixed permissions & infinite use

This commit is contained in:
Niels Vergucht 2018-12-15 23:20:18 +01:00
parent 2d84c7c32a
commit 8f7c6c1165
4 changed files with 7 additions and 30 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicBuckets</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>1.2.3</version>
<version>1.2.4</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>

View File

@ -41,14 +41,14 @@ public class CommandGenbucket extends BaseCommand {
@Default
@Description("Opens up the Genbucket shop")
public void shop(Player player) {
if (!permCheck(player, "genbucket.shop")) return;
if (!permCheck(player, "epicbuckets.shop")) return;
new GUIMain(player).open();
}
@Subcommand("reload")
@Description("Reloads the messages & config files")
public void reload(Player player) {
if (!permCheck(player, "genbucket.reload")) return;
if (!permCheck(player, "epicbuckets.reload")) return;
epicBuckets.reload();
player.sendMessage(ChatUtil.colorPrefix(epicBuckets.getLocale().getMessage("command.reload.success")));
}
@ -56,14 +56,14 @@ public class CommandGenbucket extends BaseCommand {
@Subcommand("admin toggle")
@Description("Toggles your admin status to receive genbucket placement notifications")
public void admin(Player player) {
if (!permCheck(player, "genbucket.admin") || !permCheck(player, "genbucket.admin.toggle")) return;
if (!permCheck(player, "epicbuckets.admin") || !permCheck(player, "epicbuckets.admin.toggle")) return;
epicBuckets.getGenbucketManager().toggleAdmin(player);
}
@Subcommand("admin panel")
@Description("Opens up the panel with all the active genbuckets")
public void panel(Player player) {
if (!permCheck(player, "genbucket.admin") || !permCheck(player, "genbucket.admin.panel")) return;
if (!permCheck(player, "epicbuckets.admin") || !permCheck(player, "epicbuckets.admin.panel")) return;
GUIPanel.PANEL.open(player);
}

View File

@ -38,7 +38,7 @@ public class GenbucketPlaceListener implements Listener {
e.setCancelled(true);
if (!e.getPlayer().hasPermission("genbucket.place")) {
if (!e.getPlayer().hasPermission("epicbuckets.place")) {
e.getPlayer().sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.place.nothere"));
return;
}
@ -80,7 +80,7 @@ public class GenbucketPlaceListener implements Listener {
return;
}
if (e.getPlayer().getGameMode() != GameMode.CREATIVE || !EpicBuckets.getInstance().getConfigManager().isUnlimitedGenbuckets()) {
if (e.getPlayer().getGameMode() != GameMode.CREATIVE && !EpicBuckets.getInstance().getConfigManager().isUnlimitedGenbuckets()) {
if (e.getItem().getAmount() > 1) {
e.getItem().setAmount(e.getItem().getAmount() - 1);
} else {

View File

@ -1,23 +0,0 @@
package com.songoda.epicbuckets.regionhandler;
import com.massivecraft.factions.*;
import com.songoda.epicbuckets.EpicBuckets;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class RegionMassiveCraftFactions {
public static boolean canBuild(Player player, Location location) {
if (!EpicBuckets.getInstance().getConfigManager().isSupportFactions()) return true;
if (!EpicBuckets.getInstance().getServer().getPluginManager().isPluginEnabled("Factions")) return true;
Faction f = Board.getInstance().getFactionAt(new FLocation(location));
if (f == null) return false;
if (FPlayers.getInstance().getByPlayer(player).getFaction() != f) return false;
return true;
}
}