Merge branch 'perm-changes'

Conflicts:
	Plugins/.idea/encodings.xml
reverted it.
This commit is contained in:
Mini-Chiss 2015-07-29 14:06:21 +02:00
commit 932fe197b4
19 changed files with 76 additions and 36 deletions

View File

@ -1,20 +1,20 @@
package mineplex.core.common;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
public enum Rank
{
LT("LT", ChatColor.DARK_RED),
OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED),
JNR_DEV("Jr.Dev", ChatColor.RED),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
MODERATOR("Mod", ChatColor.GOLD),
JNR_DEV("Jr.Dev", ChatColor.RED),
HELPER("Trainee", ChatColor.DARK_AQUA),
MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
MAPDEV("Builder", ChatColor.BLUE),

View File

@ -19,12 +19,20 @@ public class UpdateRank extends CommandBase<CoreClientManager>
{
public UpdateRank(CoreClientManager plugin)
{
super(plugin, Rank.ADMIN, "updateRank");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
}
@Override
public void Execute(final Player caller, String[] args)
{
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
{
F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.GetTag(true, true)) + "s are only permitted to set ranks on test servers!");
return;
}
if (args == null)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
@ -52,9 +60,9 @@ public class UpdateRank extends CommandBase<CoreClientManager>
final Rank rank = tempRank;
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.JNR_DEV || rank == Rank.DEVELOPER)
{
if (rank == Rank.ADMIN && !Plugin.hasRank(caller, Rank.LT))
if (!testServer && rank.Has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
{
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
return;

View File

@ -208,20 +208,22 @@ public class AchievementManager extends MiniPlugin
{
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
if (sender.getName().equalsIgnoreCase("Phinary") || sender.getName().equalsIgnoreCase("Horus"))
level = -level;
else if (sender.getName().equalsIgnoreCase("B2_mp"))
if (sender.getName().equalsIgnoreCase("B2_mp"))
return 101;
else if (rank.Has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
else if (rank.Has(Rank.ADMIN))
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
else if (rank.Has(Rank.SNR_MODERATOR))
level = Math.max(level, 15);
else if (rank.Has(Rank.MODERATOR))
if (rank.Has(Rank.MODERATOR))
level = Math.max(level, 5);
else if (rank.Has(Rank.JNR_DEV))
if (rank.Has(Rank.SNR_MODERATOR))
level = Math.max(level, 15);
if (rank.Has(Rank.JNR_DEV))
level = Math.max(level, 25);
if (rank.Has(Rank.ADMIN))
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (rank.Has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (sender.getName().equalsIgnoreCase("Phinary"))
level = -level;
return level;
}

View File

@ -12,7 +12,7 @@ public class HomeCommand extends CommandBase<NpcManager>
{
public HomeCommand(NpcManager plugin)
{
super(plugin, Rank.DEVELOPER, "home");
super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "home");
}
@Override

View File

@ -10,7 +10,7 @@ public class NpcCommand extends MultiCommandBase<NpcManager>
{
public NpcCommand(NpcManager plugin)
{
super(plugin, Rank.DEVELOPER, "npc");
super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "npc");
AddCommand(new AddCommand(plugin));
AddCommand(new DeleteCommand(plugin));

View File

@ -14,7 +14,7 @@ public class SendCommand extends CommandBase<Portal>
{
public SendCommand(Portal plugin)
{
super(plugin, Rank.ADMIN, "send");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "send");
}
@Override

View File

@ -261,7 +261,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN))
if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN) || getClientManager().Get(getPlayer()).GetRank() == Rank.JNR_DEV)
{
buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(38, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.ItemStack;
@ -292,6 +293,20 @@ public class PunishPage extends CraftInventoryCustom implements Listener
}, 1, false, true), new PunishButton(this, Category.ChatOffense, 4, false, -1));
}
if (_plugin.GetClients().Get(_player).GetRank() == Rank.DEVELOPER || _plugin.GetClients().Get(_player).GetRank() == Rank.JNR_DEV)
{
ShopItem devWarning = new ShopItem(Material.YELLOW_FLOWER, "DEV WARNING", new String[] {ChatColor.RESET + "Developers are advised against using the punish system", ChatColor.RESET + "unless permitted by LT"}, 1, true, true);
devWarning.addGlow();
AddButton(0, devWarning, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
}
});
}
Collections.sort(punishments, new PunishmentSorter());
int slot = 45;

View File

@ -10,7 +10,7 @@ public class HereCommand extends CommandBase<Teleport>
{
public HereCommand(Teleport plugin)
{
super(plugin, Rank.ADMIN, "here", "h");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "here", "h");
}
@Override

View File

@ -15,7 +15,7 @@ public class RestartServerCommand extends CommandBase<FileUpdater>
{
public RestartServerCommand(FileUpdater plugin)
{
super(plugin, Rank.ADMIN, "restart");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "restart");
}
@Override

View File

@ -103,7 +103,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin<HubClient>
{
// Snowman!
public HubType Type = HubType.Normal;
public HubType Type = HubType.Normal;
private BlockRestore _blockRestore;
private CoreClientManager _clientManager;
@ -495,7 +495,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler(priority = EventPriority.LOW)
public void AdminOP(PlayerJoinEvent event)
{
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
// Give developers operator on their servers
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
event.getPlayer().setOp(true);
else
event.getPlayer().setOp(false);

View File

@ -10,7 +10,7 @@ public class GadgetToggle extends CommandBase<HubManager>
{
public GadgetToggle(HubManager plugin)
{
super(plugin, Rank.ADMIN, new String[] {"gadget"});
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gadget"});
}
@Override

View File

@ -13,7 +13,7 @@ public class GameModeCommand extends CommandBase<HubManager>
{
public GameModeCommand(HubManager plugin)
{
super(plugin, Rank.ADMIN, new String[] {"gm"});
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, new String[] {"gm"});
}
@Override

View File

@ -10,7 +10,7 @@ public class NewsCommand extends MultiCommandBase<HubManager>
{
public NewsCommand(HubManager plugin)
{
super(plugin, Rank.ADMIN, "news");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "news");
AddCommand(new NewsAddCommand(plugin));
AddCommand(new NewsDeleteCommand(plugin));

View File

@ -19,7 +19,7 @@ public class NewsListCommand extends CommandBase<HubManager>
{
public NewsListCommand(HubManager plugin)
{
super(plugin, Rank.ADMIN, "list");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "list");
}
@Override

View File

@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin
for (Player player : UtilServer.getPlayers())
{
if (Manager.getPreferences().Get(player).HubForcefield && Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN))
if (Manager.getPreferences().Get(player).HubForcefield && (Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN) || Manager.GetClients().Get(player).GetRank() == Rank.JNR_DEV))
{
for (Player other : UtilServer.getPlayers())
{
@ -56,7 +56,7 @@ public class ForcefieldManager extends MiniPlugin
if (UtilMath.offset(other, player) > range)
continue;
if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN))
if (Manager.GetClients().Get(other).GetRank().Has(Rank.ADMIN) || Manager.GetClients().Get(other).GetRank() == Rank.JNR_DEV)
continue;
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))

View File

@ -829,6 +829,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
}
}
@EventHandler(priority = EventPriority.LOW)
public void AdminOP(PlayerJoinEvent event)
{
// Give developers operator on their servers
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
event.getPlayer().setOp(true);
else
event.getPlayer().setOp(false);
}
public boolean IsAlive(Player player)
{
if (_game == null)

View File

@ -3,9 +3,8 @@ package nautilus.game.arcade.command;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -13,12 +12,13 @@ import mineplex.core.common.util.ProfileLoader;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePlayer;
import nautilus.game.arcade.ArcadeManager;
public class DisguiseCommand extends CommandBase<ArcadeManager>
{
public DisguiseCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, "disguise");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.TWITCH, Rank.JNR_DEV}, "disguise");
}
@Override

View File

@ -11,7 +11,7 @@ public class WriteCommand extends CommandBase<ArcadeManager>
{
public WriteCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, "write");
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV}, "write");
}
@Override