mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Merge remote-tracking branch 'origin/TFM-1.13' into TFM-1.13
This commit is contained in:
commit
a77e53932b
@ -16,13 +16,13 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
|
||||
@ -32,12 +32,12 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldEdit:c0f82ebeff" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:c0f82ebeff" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldEdit:0909dc1972" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:0909dc1972" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:dummypermscompat:1.8" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:c0f82ebeff" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:0909dc1972" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:jchronic:0.2.4a" level="project" />
|
||||
@ -48,7 +48,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:16.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
|
||||
@ -59,9 +59,22 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.15.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:6.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldGuard:50fd4cb470" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldGuard:worldguard-core:50fd4cb470" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.intake:intake:4.2-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:squirrelid:0.2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.khelekore:prtree:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.opencsv:opencsv:2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldGuard:worldguard-legacy:50fd4cb470" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.TFPatches:BukkitSSH:master-1.2-ge9214e4-23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.sshd:sshd-core:1.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.mina:mina-core:2.0.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-jdk14:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: jline:jline:2.12.1" level="project" />
|
||||
</component>
|
||||
</module>
|
8
pom.xml
8
pom.xml
@ -130,7 +130,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.TFPatches</groupId>
|
||||
<artifactId>TF-WorldEdit</artifactId>
|
||||
<version>c0f82ebeff</version>
|
||||
<version>0909dc1972</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@ -163,9 +163,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-legacy</artifactId>
|
||||
<version>6.2</version>
|
||||
<groupId>com.github.TFPatches</groupId>
|
||||
<artifactId>TF-WorldGuard</artifactId>
|
||||
<version>50fd4cb470</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -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<String> getActiveAdminNames()
|
||||
{
|
||||
List<String> names = new ArrayList();
|
||||
for (Admin admin : activeAdmins)
|
||||
{
|
||||
names.add(admin.getName());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public boolean isAdmin(CommandSender sender)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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<String, ProtectedRegion> regions = rm.getRegions();
|
||||
Map<String, ProtectedRegion> 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()
|
||||
|
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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 = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | on | storm>]",
|
||||
usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | rain | storm>]",
|
||||
aliases = "aw")
|
||||
public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
@ -245,4 +249,47 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 = "/<command>")
|
||||
@CommandParameters(description = "Lists all possible attributes.", usage = "/<command>")
|
||||
public class Command_attributelist extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -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 = "/<command> <purge | off | <partialname> [skull | block] [blockname | playername]")
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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 = "/<command> <carts>", aliases = "ew,rd")
|
||||
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command>", aliases = "ew,rd")
|
||||
public class Command_entitywipe extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1 && plugin.al.isAdmin(sender))
|
||||
{
|
||||
return Arrays.asList("clear");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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 = "/<command> [time <morning | noon | evening | night> | weather <off | on | storm>]",
|
||||
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
|
||||
aliases = "mbw,mbworld")
|
||||
public class Command_masterbuilderworld extends FreedomCommand
|
||||
{
|
||||
@ -146,6 +150,31 @@ public class Command_masterbuilderworld extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> 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
|
||||
{
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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 = "/<command>", aliases = "mp")
|
||||
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command> [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<String> getAllMobNames()
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
for (EntityType entityType : Groups.MOB_TYPES)
|
||||
{
|
||||
names.add(entityType.name());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
return getAllMobNames();
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
return Arrays.asList("enable", "disable", "status", "clearips");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@ -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<String> 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<String> getAllPluginNames()
|
||||
{
|
||||
List<String> 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())
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> 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("<duration>");
|
||||
}
|
||||
}
|
||||
else if (args.length == 4)
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
{
|
||||
return Arrays.asList("<amplifier>");
|
||||
}
|
||||
}
|
||||
else if (args.length == 5 && plugin.al.isAdmin(sender))
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
{
|
||||
return FUtil.getPlayerList();
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<String> getAllPotionTypes()
|
||||
{
|
||||
List<String> types = new ArrayList<>();
|
||||
for (PotionEffectType potionEffectType : PotionEffectType.values())
|
||||
{
|
||||
if (potionEffectType != null)
|
||||
{
|
||||
types.add(potionEffectType.getName());
|
||||
}
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> arguments = new ArrayList<>();
|
||||
arguments.addAll(FUtil.getPlayerList());
|
||||
arguments.addAll(Arrays.asList("list", "purge", "all"));
|
||||
return arguments;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1 && plugin.al.isAdmin(sender))
|
||||
{
|
||||
return Arrays.asList("off");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
List<String> 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<String> getWhitelistedNames()
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
for (Object name : plugin.si.getWhitelisted())
|
||||
{
|
||||
names.add(String.valueOf(name));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
@ -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 = "/<command> <world>")
|
||||
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<String> getAllWorldNames()
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
names.add(world.getName());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
return getAllWorldNames();
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@ -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<TotalFreedomMod>
|
||||
{
|
||||
|
||||
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<TotalFreedomMod
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public List<String> tabComplete(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
return null;
|
||||
}*/
|
||||
// Doesn't need to do any starts-with checks
|
||||
protected List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, Command command, String alias, String[] args)
|
||||
{
|
||||
List<String> options = getTabCompleteOptions(sender, command, alias, args);
|
||||
if (options == null) {
|
||||
return null;
|
||||
}
|
||||
return StringUtil.copyPartialMatches(args[args.length - 1], options, Lists.<String>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()
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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++)
|
||||
|
@ -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("<li><a href=\"/schematic/download?schematicName=" + filename + "\">" + filename + "</a></li>");
|
||||
}
|
||||
else if (filename.length() > 254)
|
||||
{
|
||||
schematicsFormatted.add("<li>" + filename + " - (Filename too long, can't download)</li>");
|
||||
}
|
||||
else
|
||||
{
|
||||
schematicsFormatted.add("<li>" + filename + " - (Illegal filename, can't download)</li>");
|
||||
|
@ -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);
|
||||
|
@ -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<String> getPlayerList()
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
names.add(player.getName());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static List<String> getAllMaterialNames()
|
||||
{
|
||||
List<String> 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);
|
||||
|
@ -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<Material> 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<Material> 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<EntityType> 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);
|
||||
}
|
@ -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<Material> 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<Material> 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);
|
||||
}
|
@ -107,6 +107,16 @@ public final class AdminWorld extends CustomWorld
|
||||
return player;
|
||||
}
|
||||
|
||||
public List<String> getGuestList()
|
||||
{
|
||||
List<String> guests = new ArrayList<>();
|
||||
for (Player guest : guestList.keySet())
|
||||
{
|
||||
guests.add(guest.getName());
|
||||
}
|
||||
return guests;
|
||||
}
|
||||
|
||||
public Player removeGuest(String partialName)
|
||||
{
|
||||
partialName = partialName.toLowerCase();
|
||||
|
Loading…
Reference in New Issue
Block a user