diff --git a/TotalFreedomMod.iml b/TotalFreedomMod.iml
index e2f46a38..7766ed47 100644
--- a/TotalFreedomMod.iml
+++ b/TotalFreedomMod.iml
@@ -16,13 +16,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -32,12 +32,12 @@
-
-
+
+
-
+
@@ -48,7 +48,7 @@
-
+
@@ -59,9 +59,22 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index eb147032..2d74ab71 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,7 +130,7 @@
com.github.TFPatches
TF-WorldEdit
- c0f82ebeff
+ 0909dc1972
provided
@@ -163,9 +163,9 @@
- com.sk89q.worldguard
- worldguard-legacy
- 6.2
+ com.github.TFPatches
+ TF-WorldGuard
+ 50fd4cb470
provided
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java
index e125d744..e4e3c343 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java
@@ -3,7 +3,9 @@ package me.totalfreedom.totalfreedommod.admin;
import com.google.common.base.Function;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -129,6 +131,16 @@ public class AdminList extends FreedomService
return isAdmin(sender);
}
+ public List getActiveAdminNames()
+ {
+ List names = new ArrayList();
+ for (Admin admin : activeAdmins)
+ {
+ names.add(admin.getName());
+ }
+ return names;
+ }
+
public boolean isAdmin(CommandSender sender)
{
if (!(sender instanceof Player))
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java
index d86bb27b..9ba68d92 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java
@@ -5,7 +5,7 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
-import me.totalfreedom.totalfreedommod.util.MaterialGroup;
+import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -107,7 +107,7 @@ public class BlockBlocker extends FreedomService
public void onShulkerBoxPlace(BlockPlaceEvent event)
{
Block block = event.getBlock();
- if (MaterialGroup.SHULKER_BOXES.contains(event.getBlock().getType()))
+ if (Groups.SHULKER_BOXES.contains(event.getBlock().getType()))
{
ShulkerBox shulkerBox = (ShulkerBox)block.getState();
boolean empty = true;
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java
index b99d8e67..60a0bafa 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java
@@ -3,7 +3,7 @@ package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
-import me.totalfreedom.totalfreedommod.util.MaterialGroup;
+import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.ShulkerBox;
@@ -217,7 +217,7 @@ public class EventBlocker extends FreedomService
public void onBlockDispense(BlockDispenseEvent event)
{
ItemStack item = event.getItem();
- if (MaterialGroup.SHULKER_BOXES.contains(item.getType()))
+ if (Groups.SHULKER_BOXES.contains(item.getType()))
{
BlockStateMeta blockStateMeta = (BlockStateMeta)item.getItemMeta();
ShulkerBox shulkerBox = (ShulkerBox)blockStateMeta.getBlockState();
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java
index 42d4f6a0..22ba8e7f 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java
@@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.bridge;
-import com.sk89q.worldguard.bukkit.RegionContainer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
@@ -52,20 +51,20 @@ public class WorldGuardBridge extends FreedomService
return worldGuardPlugin;
}
- public Boolean wipeRegions(World world)
+ public int wipeRegions(World world)
{
- RegionContainer container = getWorldGuardPlugin().getRegionContainer();
- RegionManager rm = container.get(world);
- if (rm != null)
+ int count = 0;
+ RegionManager regionManager = getWorldGuardPlugin().getRegionManager(world);
+ if (regionManager != null)
{
- Map regions = rm.getRegions();
+ Map regions = regionManager.getRegions();
for (ProtectedRegion region : regions.values())
{
- rm.removeRegion(region.getId());
+ regionManager.removeRegion(region.getId());
+ count++;
}
- return true;
}
- return false;
+ return count;
}
public boolean isEnabled()
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java
index d8e6c950..83fc7046 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java
@@ -1,5 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -42,4 +45,15 @@ public class Command_adminmode extends FreedomCommand
return false;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1 && plugin.al.isAdmin(sender) && !(sender instanceof Player))
+ {
+ return Arrays.asList("on", "off");
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java
index 0f2b552e..a13e82d2 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java
@@ -1,5 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldTime;
@@ -11,7 +15,7 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Go to the AdminWorld.",
- usage = "/ [guest < list | purge | add | remove > | time | weather ]",
+ usage = "/ [guest < list | purge | add | remove > | time | weather ]",
aliases = "aw")
public class Command_adminworld extends FreedomCommand
{
@@ -245,4 +249,47 @@ public class Command_adminworld extends FreedomCommand
}
}
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (!plugin.al.isAdmin(sender))
+ {
+ return Collections.emptyList();
+ }
+ if (args.length == 1)
+ {
+ return Arrays.asList("guest", "time", "weather");
+ }
+ else if (args.length == 2)
+ {
+ if (args[0].equals("guest"))
+ {
+ return Arrays.asList("add", "remove", "list", "purge");
+ }
+ else if (args[0].equals("time"))
+ {
+ return Arrays.asList("morning", "noon", "evening", "night");
+ }
+ else if (args[0].equals("weather"))
+ {
+ return Arrays.asList("off", "rain", "storm");
+ }
+ }
+ else if (args.length == 3)
+ {
+ if (args[0].equals("guest"))
+ {
+ if (args[1].equals("add"))
+ {
+ return FUtil.getPlayerList();
+ }
+ else if (args[1].equals("remove"))
+ {
+ return plugin.wm.adminworld.getGuestList();
+ }
+ }
+ }
+ return Collections.emptyList();
+ }
+
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_attributelist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_attributelist.java
index f7dd3bd9..8cb9a189 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_attributelist.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_attributelist.java
@@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
-@CommandParameters(description = "Lists all possible enchantments.", usage = "/")
+@CommandParameters(description = "Lists all possible attributes.", usage = "/")
public class Command_attributelist extends FreedomCommand
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java
index 4715d2ae..e3cc3d09 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java
@@ -1,5 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -12,7 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
-@CommandParameters(description = "Place a cage around someone.", usage = "/ [skull | block] [blockname | playername]")
+@CommandParameters(description = "Place a cage around someone.", usage = "/ [skull | block] [playername | blockname]")
public class Command_cage extends FreedomCommand
{
@@ -106,4 +110,41 @@ public class Command_cage extends FreedomCommand
}
return true;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (!plugin.al.isAdmin(sender))
+ {
+ return null;
+ }
+
+ if (args.length == 1)
+ {
+ List arguments = new ArrayList<>();
+ arguments.add("purge");
+ arguments.addAll(FUtil.getPlayerList());
+ return arguments;
+ }
+ else if (args.length == 2)
+ {
+ if (!args[0].equals("purge"))
+ {
+ return Arrays.asList("off", "skull", "block");
+ }
+ }
+ else if (args.length == 3)
+ {
+ if (args[1].equals("block"))
+ {
+ return FUtil.getAllMaterialNames();
+ }
+ else if (args[1].equals("skull"))
+ {
+ return FUtil.getPlayerList();
+ }
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java
index 5fb012b1..2d834163 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java
@@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
-@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/ ", aliases = "ew,rd")
+@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/", aliases = "ew,rd")
public class Command_entitywipe extends FreedomCommand
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java
index a7b98971..32e99da8 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java
@@ -1,6 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.player.PlayerData;
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java
index fcfa338e..efec2233 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java
@@ -1,6 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -63,4 +65,15 @@ public class Command_invis extends FreedomCommand
}
return true;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1 && plugin.al.isAdmin(sender))
+ {
+ return Arrays.asList("clear");
+ }
+
+ return Collections.emptyList();
+ }
}
\ No newline at end of file
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java
index 91763ec7..3d0f3b75 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java
@@ -1,5 +1,13 @@
package me.totalfreedom.totalfreedommod.command;
+import com.google.common.collect.ContiguousSet;
+import com.google.common.collect.DiscreteDomain;
+import com.google.common.collect.Range;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.DoubleStream;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -89,4 +97,30 @@ public class Command_jumppads extends FreedomCommand
}
return true;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (!plugin.al.isAdmin(sender))
+ {
+ return Collections.emptyList();
+ }
+ if (args.length == 1)
+ {
+ return Arrays.asList("on", "off", "info", "sideways", "strength");
+ }
+ else if (args.length == 2)
+ {
+ if (args[0].equals("sideways"))
+ {
+ return Arrays.asList("on", "off");
+ }
+ else if (args[0].equals("strength"))
+ {
+ return Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
+ }
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java
index ef99d575..facbdf3f 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java
@@ -1,6 +1,10 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
+import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldTime;
import me.totalfreedom.totalfreedommod.world.WorldWeather;
import org.bukkit.World;
@@ -10,7 +14,7 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Go to the MasterBuilderWorld.",
- usage = "/ [time | weather ]",
+ usage = "/ [time | weather ]",
aliases = "mbw,mbworld")
public class Command_masterbuilderworld extends FreedomCommand
{
@@ -146,6 +150,31 @@ public class Command_masterbuilderworld extends FreedomCommand
return true;
}
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (!plugin.al.isAdmin(sender))
+ {
+ return Collections.emptyList();
+ }
+ if (args.length == 1)
+ {
+ return Arrays.asList("time", "weather");
+ }
+ else if (args.length == 2)
+ {
+ if (args[0].equals("time"))
+ {
+ return Arrays.asList("morning", "noon", "evening", "night");
+ }
+ else if (args[0].equals("weather"))
+ {
+ return Arrays.asList("off", "rain", "storm");
+ }
+ }
+ return Collections.emptyList();
+ }
+
// TODO: Redo this properly
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java
index 4c93d2b8..b74f2dd6 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java
@@ -1,6 +1,10 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
@@ -204,5 +208,44 @@ public class Command_mbconfig extends FreedomCommand
}
}
}
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (sender instanceof Player)
+ {
+ if (args.length == 1)
+ {
+ List arguments = new ArrayList<>();
+ arguments.add("list");
+ if (plugin.al.isAdmin(sender))
+ {
+ arguments.add("info");
+ }
+ return arguments;
+ }
+ else if (args.length == 2 && args[0].equals("info") && plugin.al.isAdmin(sender))
+ {
+ return plugin.al.getActiveAdminNames();
+ }
+ return Collections.emptyList();
+ }
+ else
+ {
+ if (args.length == 1)
+ {
+ return Arrays.asList("add", "remove", "reload", "list", "info");
+ }
+ else if (args.length == 2)
+ {
+ if (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info"))
+ {
+ return FUtil.getPlayerList();
+ }
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java
index 3be5ae65..6d792349 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java
@@ -1,8 +1,16 @@
package me.totalfreedom.totalfreedommod.command;
+import com.sk89q.worldedit.blocks.metadata.MobType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
+import me.totalfreedom.totalfreedommod.util.Groups;
+import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -10,32 +18,64 @@ import org.bukkit.entity.Ambient;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ghast;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
-@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/", aliases = "mp")
+@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/ [name]", aliases = "mp")
public class Command_mobpurge extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
- FUtil.adminAction(sender.getName(), "Purging all mobs", true);
- msg(purgeMobs() + " mobs removed.");
+ EntityType type = null;
+ String mobName = null;
+ if (args.length > 0)
+ {
+ try
+ {
+ type = EntityType.valueOf(args[0].toUpperCase());
+ }
+ catch (Exception e)
+ {
+ msg(args[0] + " is not a valid mob type.", ChatColor.RED);
+ return true;
+ }
+
+ if (!Groups.MOB_TYPES.contains(type))
+ {
+ msg(WordUtils.capitalizeFully(type.name().replace("_", " ")) + " is an entity, however it is not a mob.", ChatColor.RED);
+ return true;
+ }
+ }
+
+ if (type != null)
+ {
+ mobName = WordUtils.capitalizeFully(type.name().replace("_", " "));
+ }
+
+ FUtil.adminAction(sender.getName(), "Purging all " + (type != null ? mobName + "s" : "mobs"), true);
+ msg(purgeMobs(type) + " " + (type != null ? mobName : "mob") + "s removed.");
return true;
}
- public static int purgeMobs()
+ public static int purgeMobs(EntityType type)
{
int removed = 0;
for (World world : Bukkit.getWorlds())
{
for (Entity ent : world.getLivingEntities())
{
- if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient)
+ if (ent instanceof LivingEntity && !(ent instanceof Player))
{
+ if (type != null && !ent.getType().equals(type))
+ {
+ continue;
+ }
ent.remove();
removed++;
}
@@ -44,4 +84,25 @@ public class Command_mobpurge extends FreedomCommand
return removed;
}
+
+ public static List getAllMobNames()
+ {
+ List names = new ArrayList<>();
+ for (EntityType entityType : Groups.MOB_TYPES)
+ {
+ names.add(entityType.name());
+ }
+ return names;
+ }
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1)
+ {
+ return getAllMobNames();
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java
index 4fe7c321..4b9171dd 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java
@@ -1,5 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -67,4 +70,15 @@ public class Command_onlinemode extends FreedomCommand
}
return true;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1 && plugin.al.isAdmin(sender) && !(sender instanceof Player))
+ {
+ return Arrays.asList("on", "off");
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverify.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverify.java
index 93d92e7a..9dcfc018 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverify.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverify.java
@@ -1,5 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.pravian.aero.util.Ips;
@@ -97,4 +100,14 @@ public class Command_playerverify extends FreedomCommand
return false;
}
}
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1)
+ {
+ return Arrays.asList("enable", "disable", "status", "clearips");
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java
index 5e280560..4f9f6d3d 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java
@@ -1,5 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@@ -126,6 +130,39 @@ public class Command_plugincontrol extends FreedomCommand
return false;
}
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (!plugin.al.isAdmin(sender))
+ {
+ return Collections.emptyList();
+ }
+ if (args.length == 1)
+ {
+ return Arrays.asList("enable", "disable", "reload", "list");
+ }
+ else if (args.length == 2)
+ {
+ if (!args[0].equals("list"))
+ {
+ return getAllPluginNames();
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ public List getAllPluginNames()
+ {
+ List names = new ArrayList<>();
+ for (Plugin plugin : server.getPluginManager().getPlugins())
+ {
+ names.add(plugin.getName());
+ }
+ names.remove(plugin.getName());
+ return names;
+ }
+
public Plugin getPlugin(String name)
{
for (Plugin serverPlugin : server.getPluginManager().getPlugins())
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java
index 24e0bb61..a9412cf7 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java
@@ -1,6 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -71,7 +73,7 @@ public class Command_potion extends FreedomCommand
{
if (!plugin.al.isAdmin(sender))
{
- msg("Only superadmins can clear potion effects from other players.");
+ msg(ChatColor.RED + "Only admins can clear potion effects from other players.");
return true;
}
}
@@ -115,7 +117,7 @@ public class Command_potion extends FreedomCommand
{
if (!plugin.al.isAdmin(sender))
{
- sender.sendMessage("Only superadmins can apply potion effects to other players.");
+ sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players.");
return true;
}
}
@@ -177,4 +179,70 @@ public class Command_potion extends FreedomCommand
}
return true;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1)
+ {
+ List arguments = new ArrayList<>();
+ arguments.addAll(Arrays.asList("list", "clear", "add"));
+ if (plugin.al.isAdmin(sender))
+ {
+ arguments.add("clearall");
+ }
+ return arguments;
+ }
+ else if (args.length == 2)
+ {
+ if (args[0].equals("clear"))
+ {
+ if (plugin.al.isAdmin(sender))
+ {
+ return FUtil.getPlayerList();
+ }
+ }
+ else if (args[0].equals("add"))
+ {
+ return getAllPotionTypes();
+ }
+ }
+ else if (args.length == 3)
+ {
+ if (args[0].equals("add"))
+ {
+ return Arrays.asList("");
+ }
+ }
+ else if (args.length == 4)
+ {
+ if (args[0].equals("add"))
+ {
+ return Arrays.asList("");
+ }
+ }
+ else if (args.length == 5 && plugin.al.isAdmin(sender))
+ {
+ if (args[0].equals("add"))
+ {
+ return FUtil.getPlayerList();
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ public List getAllPotionTypes()
+ {
+ List types = new ArrayList<>();
+ for (PotionEffectType potionEffectType : PotionEffectType.values())
+ {
+ if (potionEffectType != null)
+ {
+ types.add(potionEffectType.getName());
+ }
+ }
+ return types;
+ }
+
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java
index c2176bfa..cc4df7c6 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java
@@ -66,7 +66,7 @@ public class Command_purgeall extends FreedomCommand
plugin.fm.setGlobalFreeze(false);
// Remove all mobs
- Command_mobpurge.purgeMobs();
+ Command_mobpurge.purgeMobs(null);
return true;
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java
index db00338c..adeb6e8e 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java
@@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
-import me.totalfreedom.totalfreedommod.util.MaterialGroup;
+import me.totalfreedom.totalfreedommod.util.Groups;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@@ -32,7 +32,7 @@ public class Command_ro extends FreedomCommand
String names = null;
if (args[0].equalsIgnoreCase("shulker_boxes") || args[0].equalsIgnoreCase("shulkers"))
{
- materials.addAll(MaterialGroup.SHULKER_BOXES);
+ materials.addAll(Groups.SHULKER_BOXES);
names = "shulker boxes";
}
else
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java
index 78522fc9..0eaa8b4b 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java
@@ -1,6 +1,10 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@@ -82,7 +86,7 @@ public class Command_saconfig extends FreedomCommand
if (!rank.isAtLeast(Rank.SUPER_ADMIN))
{
- msg("Rank must be superadmin or higher.", ChatColor.RED);
+ msg("Rank must be Super Admin or higher.", ChatColor.RED);
return true;
}
@@ -301,4 +305,47 @@ public class Command_saconfig extends FreedomCommand
}
}
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (sender instanceof Player)
+ {
+ if (args.length == 1)
+ {
+ List arguments = new ArrayList<>();
+ arguments.add("list");
+ if (plugin.al.isAdmin(sender))
+ {
+ arguments.add("info");
+ }
+ return arguments;
+ }
+ else if (args.length == 2 && args[0].equals("info") && plugin.al.isAdmin(sender))
+ {
+ return plugin.al.getActiveAdminNames();
+ }
+ return Collections.emptyList();
+ }
+ else
+ {
+ if (args.length == 1)
+ {
+ return Arrays.asList("add", "remove", "clean", "reload", "setrank", "info", "list");
+ }
+ else if (args.length == 2)
+ {
+ if (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info"))
+ {
+ return FUtil.getPlayerList();
+ }
+ }
+ else if (args.length == 3 && args[0].equals("setrank"))
+ {
+ return Arrays.asList("super_admin", "telnet_admin", "senior_admin");
+ }
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java
index fb1f6cc9..647bb011 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java
@@ -1,5 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
@@ -150,4 +154,23 @@ public class Command_stfu extends FreedomCommand
return true;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (!plugin.al.isAdmin(sender))
+ {
+ return null;
+ }
+
+ if (args.length == 1)
+ {
+ List arguments = new ArrayList<>();
+ arguments.addAll(FUtil.getPlayerList());
+ arguments.addAll(Arrays.asList("list", "purge", "all"));
+ return arguments;
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java
index f37da7f1..5079f342 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java
@@ -1,5 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.GameRuleHandler;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
@@ -160,5 +163,18 @@ public class Command_toggle extends FreedomCommand
{
msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1)
+ {
+ return Arrays.asList(
+ "waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
+ "firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives");
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java
index d6cd07c5..a723133c 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java
@@ -1,5 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -27,4 +30,15 @@ public class Command_trail extends FreedomCommand
return true;
}
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1 && plugin.al.isAdmin(sender))
+ {
+ return Arrays.asList("off");
+ }
+
+ return Collections.emptyList();
+ }
+
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java
index ecef19c6..9ae7d418 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java
@@ -1,5 +1,9 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
import me.totalfreedom.totalfreedommod.util.FUtil;
@@ -160,4 +164,46 @@ public class Command_whitelist extends FreedomCommand
}
return false;
}
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1)
+ {
+ List arguments = new ArrayList<>();
+ arguments.addAll(Arrays.asList("list", "count"));
+ if (plugin.al.isAdmin(sender))
+ {
+ arguments.addAll(Arrays.asList("on", "off", "add", "remove", "addall"));
+ if (!(sender instanceof Player))
+ {
+ arguments.add("purge");
+ }
+ }
+ return arguments;
+ }
+ else if (args.length == 2 && plugin.al.isAdmin(sender))
+ {
+ if (args[0].equals("add"))
+ {
+ return FUtil.getPlayerList();
+ }
+ else if (args[0].equals("remove"))
+ {
+ return getWhitelistedNames();
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ public List getWhitelistedNames()
+ {
+ List names = new ArrayList<>();
+ for (Object name : plugin.si.getWhitelisted())
+ {
+ names.add(String.valueOf(name));
+ }
+ return names;
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java
index a4bb911a..bf6be296 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java
@@ -1,5 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
@@ -8,7 +11,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
+@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Wipe all WorldGuard regions for a specified world.", usage = "/ ")
public class Command_wiperegions extends FreedomCommand
{
@@ -29,22 +32,43 @@ public class Command_wiperegions extends FreedomCommand
World world = server.getWorld(args[0]);
if (world == null)
{
- msg("World : \"" + args[0] + "\" not found.");
+ msg("There is no world named \"" + args[0] + "\"", ChatColor.RED);
return true;
}
- if (world.equals(plugin.wm.adminworld.getWorld()))
+
+ int regionsWiped = plugin.wgb.wipeRegions(world);
+
+ if (regionsWiped != 0)
{
- checkRank(Rank.SENIOR_ADMIN);
- }
- if (plugin.wgb.wipeRegions(world))
- {
- FUtil.adminAction(sender.getName(), "Wiping regions for world: " + world.getName(), true);
+ FUtil.adminAction(sender.getName(), "Wiped all regions in " + world.getName(), true);
+ msg("Wiped " + regionsWiped + " regions in " + world.getName());
return true;
}
else
{
- msg(ChatColor.RED + "No regions were found in: \"" + world.getName() + "\".");
+ msg(ChatColor.RED + "No regions were found in \"" + world.getName() + "\"");
return true;
}
}
+
+ public List getAllWorldNames()
+ {
+ List names = new ArrayList<>();
+ for (World world : server.getWorlds())
+ {
+ names.add(world.getName());
+ }
+ return names;
+ }
+
+ @Override
+ public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
+ {
+ if (args.length == 1)
+ {
+ return getAllWorldNames();
+ }
+
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java
index 3996904e..6510b784 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java
@@ -1,5 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
+import com.google.common.collect.Lists;
+import java.util.List;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
@@ -14,13 +16,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
+import org.bukkit.util.StringUtil;
public abstract class FreedomCommand extends AbstractCommandBase
{
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
- public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
public static final String PLAYER_NOT_FOUND = ChatColor.GRAY + "Player not found!";
//
@Getter
@@ -66,6 +68,26 @@ public abstract class FreedomCommand extends AbstractCommandBase tabComplete(CommandSender sender, Command command, String alias, String[] args)
+ {
+ return null;
+ }*/
+ // Doesn't need to do any starts-with checks
+ protected List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) {
+ return null;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, Command command, String alias, String[] args)
+ {
+ List options = getTabCompleteOptions(sender, command, alias, args);
+ if (options == null) {
+ return null;
+ }
+ return StringUtil.copyPartialMatches(args[args.length - 1], options, Lists.newArrayList());
+ }
+
protected abstract boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole);
protected void checkConsole()
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java
index c7051759..89da7781 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java
@@ -7,7 +7,7 @@ import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
-import me.totalfreedom.totalfreedommod.util.MaterialGroup;
+import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -72,7 +72,7 @@ public class Jumppads extends FreedomService
{
canPush = true;
}
- if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
+ if (Groups.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
{
if (canPush)
{
@@ -88,29 +88,29 @@ public class Jumppads extends FreedomService
}
else
{
- if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
+ if (Groups.WOOL_COLORS.contains(block.getRelative(0, -1, 0).getType()))
{
velocity.add(new Vector(0.0, strength, 0.0));
}
if (players.get(event.getPlayer()) == JumpPadMode.NORMAL_AND_SIDEWAYS)
{
- if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(1, 0, 0).getType()))
+ if (Groups.WOOL_COLORS.contains(block.getRelative(1, 0, 0).getType()))
{
velocity.add(new Vector(-DAMPING_COEFFICIENT * strength, 0.0, 0.0));
}
- if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(-1, 0, 0).getType()))
+ if (Groups.WOOL_COLORS.contains(block.getRelative(-1, 0, 0).getType()))
{
velocity.add(new Vector(DAMPING_COEFFICIENT * strength, 0.0, 0.0));
}
- if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, 0, 1).getType()))
+ if (Groups.WOOL_COLORS.contains(block.getRelative(0, 0, 1).getType()))
{
velocity.add(new Vector(0.0, 0.0, -DAMPING_COEFFICIENT * strength));
}
- if (MaterialGroup.WOOL_COLORS.contains(block.getRelative(0, 0, -1).getType()))
+ if (Groups.WOOL_COLORS.contains(block.getRelative(0, 0, -1).getType()))
{
velocity.add(new Vector(0.0, 0.0, DAMPING_COEFFICIENT * strength));
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java
index 24dc68a5..bf480e7c 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java
@@ -5,7 +5,7 @@ import java.util.Random;
import java.util.Set;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
-import me.totalfreedom.totalfreedommod.util.MaterialGroup;
+import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -65,7 +65,7 @@ public class Trailer extends FreedomService
return;
}
- fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size())));
+ fromBlock.setType(Groups.WOOL_COLORS.get(random.nextInt(Groups.WOOL_COLORS.size())));
BlockData data = fromBlock.getBlockData();
Material material = Material.getMaterial(String.valueOf(fromBlock.getType()));
for (int x = -1; x <= 1; x++)
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java
index 6a2f0e25..7df40767 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java
@@ -27,7 +27,7 @@ public class Module_schematic extends HTTPDModule
private static final File SCHEMATIC_FOLDER = new File("./plugins/WorldEdit/schematics/");
private static final String REQUEST_FORM_FILE_ELEMENT_NAME = "schematicFile";
- private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9_'!,\\-]{1,30}\\.schematic$");
+ private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9_'!,\\-]*\\.(schem|schematic)$");
private static final String[] SCHEMATIC_FILTER = new String[]
{
"schematic"
@@ -89,6 +89,10 @@ public class Module_schematic extends HTTPDModule
{
schematicsFormatted.add("" + filename + "");
}
+ else if (filename.length() > 254)
+ {
+ schematicsFormatted.add("" + filename + " - (Filename too long, can't download)");
+ }
else
{
schematicsFormatted.add("" + filename + " - (Illegal filename, can't download)");
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
index 0a6548b1..c816809a 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java
@@ -50,10 +50,10 @@ public class RankManager extends FreedomService
return Rank.IMPOSTOR;
}
- // Master builders show up if they are not admins
- if (plugin.mbl.isMasterBuilder(player) && !plugin.al.isAdmin(player))
+ // If the player's an owner, display that
+ if (ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
{
- return Title.MASTER_BUILDER;
+ return Title.OWNER;
}
// Developers always show up
@@ -67,10 +67,10 @@ public class RankManager extends FreedomService
return Title.EXECUTIVE;
}
- // If the player's an owner, display that
- if (ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
+ // Master builders show up if they are not admins
+ if (plugin.mbl.isMasterBuilder(player) && !plugin.al.isAdmin(player))
{
- return Title.OWNER;
+ return Title.MASTER_BUILDER;
}
return getRank(player);
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
index 2f3544b5..92ae1a49 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
@@ -29,6 +29,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
+import org.bukkit.Material;
public class FUtil
{
@@ -84,6 +85,26 @@ public class FUtil
return ConfigEntry.SERVER_OWNERS.getStringList().contains(name) || ConfigEntry.SERVER_EXECUTIVES.getStringList().contains(name);
}
+ public static List getPlayerList()
+ {
+ List names = new ArrayList<>();
+ for (Player player : Bukkit.getOnlinePlayers())
+ {
+ names.add(player.getName());
+ }
+ return names;
+ }
+
+ public static List getAllMaterialNames()
+ {
+ List names = new ArrayList<>();
+ for (Material material : Material.values())
+ {
+ names.add(material.name());
+ }
+ return names;
+ }
+
public static void bcastMsg(String message, ChatColor color)
{
FLog.info(message, true);
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java b/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java
new file mode 100644
index 00000000..4b44bfa0
--- /dev/null
+++ b/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java
@@ -0,0 +1,94 @@
+package me.totalfreedom.totalfreedommod.util;
+
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.Material;
+import org.bukkit.entity.EntityType;
+
+public class Groups
+{
+ public static final List WOOL_COLORS = Arrays.asList(
+ Material.WHITE_WOOL,
+ Material.RED_WOOL,
+ Material.ORANGE_WOOL,
+ Material.YELLOW_WOOL,
+ Material.GREEN_WOOL,
+ Material.LIME_WOOL,
+ Material.LIGHT_BLUE_WOOL,
+ Material.CYAN_WOOL,
+ Material.BLUE_WOOL,
+ Material.PURPLE_WOOL,
+ Material.MAGENTA_WOOL,
+ Material.PINK_WOOL,
+ Material.BROWN_WOOL,
+ Material.GRAY_WOOL,
+ Material.LIGHT_GRAY_WOOL,
+ Material.BLACK_WOOL);
+ public static final List SHULKER_BOXES = Arrays.asList(
+ Material.SHULKER_BOX,
+ Material.WHITE_SHULKER_BOX,
+ Material.RED_SHULKER_BOX,
+ Material.ORANGE_SHULKER_BOX,
+ Material.YELLOW_SHULKER_BOX,
+ Material.GREEN_SHULKER_BOX,
+ Material.LIME_SHULKER_BOX,
+ Material.LIGHT_BLUE_SHULKER_BOX,
+ Material.CYAN_SHULKER_BOX,
+ Material.BLUE_SHULKER_BOX,
+ Material.PURPLE_SHULKER_BOX,
+ Material.MAGENTA_SHULKER_BOX,
+ Material.PINK_SHULKER_BOX,
+ Material.BROWN_SHULKER_BOX,
+ Material.GRAY_SHULKER_BOX,
+ Material.LIGHT_GRAY_SHULKER_BOX,
+ Material.BLACK_SHULKER_BOX);
+
+ public static final List MOB_TYPES = Arrays.asList(
+ EntityType.BAT,
+ EntityType.BLAZE,
+ EntityType.CAVE_SPIDER,
+ EntityType.CHICKEN,
+ EntityType.COD,
+ EntityType.COW,
+ EntityType.CREEPER,
+ EntityType.DOLPHIN,
+ EntityType.DROWNED,
+ EntityType.ENDER_DRAGON,
+ EntityType.ENDERMAN,
+ EntityType.EVOKER,
+ EntityType.GHAST,
+ EntityType.GIANT,
+ EntityType.HUSK,
+ EntityType.ILLUSIONER,
+ EntityType.IRON_GOLEM,
+ EntityType.HORSE,
+ EntityType.LLAMA,
+ EntityType.MAGMA_CUBE,
+ EntityType.MUSHROOM_COW,
+ EntityType.OCELOT,
+ EntityType.PARROT,
+ EntityType.PHANTOM,
+ EntityType.PIG,
+ EntityType.PIG_ZOMBIE,
+ EntityType.POLAR_BEAR,
+ EntityType.PUFFERFISH,
+ EntityType.SHEEP,
+ EntityType.SHULKER,
+ EntityType.SILVERFISH,
+ EntityType.SKELETON,
+ EntityType.SLIME,
+ EntityType.SNOWMAN,
+ EntityType.SPIDER,
+ EntityType.SQUID,
+ EntityType.STRAY,
+ EntityType.TROPICAL_FISH,
+ EntityType.TURTLE,
+ EntityType.VEX,
+ EntityType.VILLAGER,
+ EntityType.WITCH,
+ EntityType.WITHER,
+ EntityType.WITHER_SKELETON,
+ EntityType.VINDICATOR,
+ EntityType.WOLF,
+ EntityType.ZOMBIE);
+}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/MaterialGroup.java b/src/main/java/me/totalfreedom/totalfreedommod/util/MaterialGroup.java
deleted file mode 100644
index d3b5b4ff..00000000
--- a/src/main/java/me/totalfreedom/totalfreedommod/util/MaterialGroup.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package me.totalfreedom.totalfreedommod.util;
-
-import java.util.Arrays;
-import java.util.List;
-import org.bukkit.Material;
-
-public class MaterialGroup
-{
- public static final List WOOL_COLORS = Arrays.asList(
- Material.WHITE_WOOL,
- Material.RED_WOOL,
- Material.ORANGE_WOOL,
- Material.YELLOW_WOOL,
- Material.GREEN_WOOL,
- Material.LIME_WOOL,
- Material.LIGHT_BLUE_WOOL,
- Material.CYAN_WOOL,
- Material.BLUE_WOOL,
- Material.PURPLE_WOOL,
- Material.MAGENTA_WOOL,
- Material.PINK_WOOL,
- Material.BROWN_WOOL,
- Material.GRAY_WOOL,
- Material.LIGHT_GRAY_WOOL,
- Material.BLACK_WOOL);
- public static final List SHULKER_BOXES = Arrays.asList(
- Material.SHULKER_BOX,
- Material.WHITE_SHULKER_BOX,
- Material.RED_SHULKER_BOX,
- Material.ORANGE_SHULKER_BOX,
- Material.YELLOW_SHULKER_BOX,
- Material.GREEN_SHULKER_BOX,
- Material.LIME_SHULKER_BOX,
- Material.LIGHT_BLUE_SHULKER_BOX,
- Material.CYAN_SHULKER_BOX,
- Material.BLUE_SHULKER_BOX,
- Material.PURPLE_SHULKER_BOX,
- Material.MAGENTA_SHULKER_BOX,
- Material.PINK_SHULKER_BOX,
- Material.BROWN_SHULKER_BOX,
- Material.GRAY_SHULKER_BOX,
- Material.LIGHT_GRAY_SHULKER_BOX,
- Material.BLACK_SHULKER_BOX);
-}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java b/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java
index 5d1bf292..2d478563 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java
@@ -107,6 +107,16 @@ public final class AdminWorld extends CustomWorld
return player;
}
+ public List getGuestList()
+ {
+ List guests = new ArrayList<>();
+ for (Player guest : guestList.keySet())
+ {
+ guests.add(guest.getName());
+ }
+ return guests;
+ }
+
public Player removeGuest(String partialName)
{
partialName = partialName.toLowerCase();