Merge pull request #198 from AtlasMediaGroup/RELEASE-2022.02

Release 2022.02
This commit is contained in:
Ryan 2022-06-04 15:04:16 +01:00 committed by GitHub
commit 0f1fbf9481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 295 additions and 411 deletions

View File

@ -41,7 +41,7 @@ jobs:
uses: actions/setup-java@v2.3.0 uses: actions/setup-java@v2.3.0
with: with:
# The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28 # The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
java-version: 11 java-version: 17
distribution: 'adopt' distribution: 'adopt'
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.

View File

@ -1,21 +0,0 @@
name: Java11-Maven-Build
on: [push]
jobs:
build-java-11:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v1
# Java 11 Builds
- name: Set up JDK 11
uses: actions/setup-java@v2.3.0
with:
java-version: 11
distribution: 'adopt'
- name: Build with Maven
run: mvn -B package --file pom.xml

View File

@ -9,16 +9,16 @@ In terms of plugin releases, our support matrix is as follows:
### Actively Supported ### Actively Supported
These versions are currently actively supported by our team, and you should expect security patches where appropriate for these versions. These versions are currently actively supported by our team, and you should expect security patches where appropriate for these versions.
| Version | Supported | Support End: | | Version | Supported | Support End: |
| ------------------- | ------------------ | ------------------------------ | | ------------------- | ---------- | ------------------------------ |
| 2021.09 | :white_check_mark: | No Earlier than December 2021 | | 2022.02 | ✅ | No Earlier than May 2022 |
### Legacy Supported ### Legacy Supported
These versions are no longer under active development, however we will look to release critical secuirty patches where appropriate. These versions are no longer under active development, however we will look to release critical secuirty patches where appropriate.
| Version | Supported | Support End: | | Version | Supported | Support End: |
| ------------------- | ------------------ | ------------ | | ------------------- | ---------- | ------------ |
| 2021.06 | :white_check_mark: | October 2021 | | 2021.09 | ⚠️ | April 2022 |
### No Longer Supported ### No Longer Supported
@ -26,8 +26,9 @@ These versions are no longer supported at all. It is strongly advised to update
| Version | Supported | Support Ended: | | Version | Supported | Support Ended: |
| ------------------- | ------------------ | ------------------- | | ------------------- | ------------------ | ------------------- |
| 2021.05 | :white_check_mark: | September 2021 | | 2021.06 | :x: | October 2021 |
| 2021.04 | :white_check_mark: | July 2021 | | 2021.05 | :x: | September 2021 |
| 2021.04 | :x: | July 2021 |
| 2021.02 | :x: | 6 June 2021 | | 2021.02 | :x: | 6 June 2021 |
| 2020.11 | :x: | 3 May 2021 | | 2020.11 | :x: | 3 May 2021 |
| 6.0.x (Pre-Release) | :x: | December 2020 | | 6.0.x (Pre-Release) | :x: | December 2020 |

View File

@ -13,7 +13,7 @@ You can copy and paste the single properties, into the pom.xml file and the IDE
That way multiple projects can share the same settings (useful for formatting rules for example). That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project. Any value defined here will override the pom.xml file value but is only applicable to the current project.
--> -->
<netbeans.hint.jdkPlatform>JDK_11</netbeans.hint.jdkPlatform> <netbeans.hint.jdkPlatform>JDK_17</netbeans.hint.jdkPlatform>
<netbeans.checkstyle.format>true</netbeans.checkstyle.format> <netbeans.checkstyle.format>true</netbeans.checkstyle.format>
</properties> </properties>
</project-shared-configuration> </project-shared-configuration>

33
pom.xml
View File

@ -5,7 +5,7 @@
<groupId>me.totalfreedom</groupId> <groupId>me.totalfreedom</groupId>
<artifactId>TotalFreedomMod</artifactId> <artifactId>TotalFreedomMod</artifactId>
<version>2021.09</version> <version>2022.02</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
@ -142,7 +142,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId> <artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version> <version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -163,7 +163,7 @@
<dependency> <dependency>
<groupId>com.sk89q.worldedit</groupId> <groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId> <artifactId>worldedit-bukkit</artifactId>
<version>7.2.4</version> <version>7.2.8</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -177,14 +177,14 @@
<dependency> <dependency>
<groupId>net.coreprotect</groupId> <groupId>net.coreprotect</groupId>
<artifactId>coreprotect</artifactId> <artifactId>coreprotect</artifactId>
<version>19.5</version> <version>20.4</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sk89q.worldguard</groupId> <groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId> <artifactId>worldguard-bukkit</artifactId>
<version>7.0.4</version> <version>7.0.6</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -203,10 +203,10 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.ess3</groupId> <groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId> <artifactId>EssentialsX</artifactId>
<version>2.18.2</version> <version>2.19.0</version>
<scope>compile</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -227,7 +227,7 @@
<groupId>me.totalfreedom</groupId> <groupId>me.totalfreedom</groupId>
<artifactId>tfguilds</artifactId> <artifactId>tfguilds</artifactId>
<version>2021.06-RC2</version> <version>2021.06-RC2</version>
<scope>compile</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -258,6 +258,13 @@
</dependency> </dependency>
</dependencies> </dependencies>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<build> <build>
<!-- Filter resources for build.properties --> <!-- Filter resources for build.properties -->
<resources> <resources>
@ -275,9 +282,9 @@
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<outputFileName>TotalFreedomMod.jar</outputFileName> <outputFileName>TotalFreedomMod.jar</outputFileName>
<compilerVersion>11</compilerVersion> <compilerVersion>17</compilerVersion>
<source>11</source> <source>17</source>
<target>11</target> <target>17</target>
</configuration> </configuration>
</plugin> </plugin>
@ -401,7 +408,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version> <version>3.3.0</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>

View File

@ -1,98 +0,0 @@
package me.totalfreedom.totalfreedommod;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;
import me.totalfreedom.totalfreedommod.util.FLog;
import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME;
public class SavedFlags extends FreedomService
{
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
@SuppressWarnings("unchecked")
public Map<String, Boolean> getSavedFlags()
{
Map<String, Boolean> flags = null;
File input = new File(TotalFreedomMod.getPlugin().getDataFolder(), SAVED_FLAGS_FILENAME);
if (input.exists())
{
try
{
try (FileInputStream fis = new FileInputStream(input); ObjectInputStream ois = new ObjectInputStream(fis))
{
flags = (HashMap<String, Boolean>)ois.readObject();
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return flags;
}
public boolean getSavedFlag(String flag) throws Exception
{
Boolean flagValue = null;
Map<String, Boolean> flags = getSavedFlags();
if (flags != null)
{
if (flags.containsKey(flag))
{
flagValue = flags.get(flag);
}
}
if (flagValue != null)
{
return flagValue;
}
else
{
throw new Exception();
}
}
public void setSavedFlag(String flag, boolean value)
{
Map<String, Boolean> flags = getSavedFlags();
if (flags == null)
{
flags = new HashMap<>();
}
flags.put(flag, value);
try
{
final FileOutputStream fos = new FileOutputStream(new File(plugin.getDataFolder(), SAVED_FLAGS_FILENAME));
final ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(flags);
oos.close();
fos.close();
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
}

View File

@ -4,14 +4,14 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_16_R3.EntityPlayer; import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.v1_16_R3.MinecraftServer; import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
public class ServerInterface extends FreedomService public class ServerInterface extends FreedomService
{ {
public static final String COMPILE_NMS_VERSION = "v1_16_R3"; public static final String COMPILE_NMS_VERSION = "v1_17_R1";
public static void warnVersion() public static void warnVersion()
{ {
@ -34,16 +34,11 @@ public class ServerInterface extends FreedomService
{ {
} }
public void setOnlineMode(boolean mode)
{
getServer().setOnlineMode(mode);
}
public int purgeWhitelist() public int purgeWhitelist()
{ {
String[] whitelisted = getServer().getPlayerList().getWhitelisted(); String[] whitelisted = getServer().getPlayerList().getWhitelisted();
int size = whitelisted.length; int size = whitelisted.length;
for (EntityPlayer player : getServer().getPlayerList().players) for (EntityPlayer player : getServer().getPlayerList().getPlayers())
{ {
getServer().getPlayerList().getWhitelist().remove(player.getProfile()); getServer().getPlayerList().getWhitelist().remove(player.getProfile());
} }

View File

@ -75,7 +75,6 @@ public class TotalFreedomMod extends JavaPlugin
public CommandLoader cl; public CommandLoader cl;
// Services // Services
public ServerInterface si; public ServerInterface si;
public SavedFlags sf;
public WorldManager wm; public WorldManager wm;
public LogViewer lv; public LogViewer lv;
public AdminList al; public AdminList al;
@ -187,7 +186,6 @@ public class TotalFreedomMod extends JavaPlugin
fsh = new FreedomServiceHandler(); fsh = new FreedomServiceHandler();
config = new MainConfig(); config = new MainConfig();
config.load();
if (FUtil.inDeveloperMode()) if (FUtil.inDeveloperMode())
{ {
@ -299,7 +297,6 @@ public class TotalFreedomMod extends JavaPlugin
{ {
// Start services // Start services
si = new ServerInterface(); si = new ServerInterface();
sf = new SavedFlags();
wm = new WorldManager(); wm = new WorldManager();
lv = new LogViewer(); lv = new LogViewer();
sql = new SQLite(); sql = new SQLite();

View File

@ -1,10 +1,10 @@
package me.totalfreedom.totalfreedommod.blocking; package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Tag; import org.bukkit.Tag;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -35,7 +35,7 @@ public class SignBlocker extends FreedomService
if (Tag.SIGNS.getValues().contains(event.getBlock().getType())) if (Tag.SIGNS.getValues().contains(event.getBlock().getType()))
{ {
ItemStack sign = event.getItemInHand(); ItemStack sign = event.getItemInHand();
net.minecraft.server.v1_16_R3.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign); net.minecraft.world.item.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
NBTTagCompound compound = (nmsSign.hasTag()) ? nmsSign.getTag() : new NBTTagCompound(); NBTTagCompound compound = (nmsSign.hasTag()) ? nmsSign.getTag() : new NBTTagCompound();
assert compound != null; assert compound != null;
NBTTagCompound bet = compound.getCompound("BlockEntityTag"); NBTTagCompound bet = compound.getCompound("BlockEntityTag");

View File

@ -192,7 +192,6 @@ public class CoreProtectBridge extends FreedomService
return (megabytes / 1024); return (megabytes / 1024);
} }
// Wipes DB for the specified world
public void clearDatabase(World world) public void clearDatabase(World world)
{ {
clearDatabase(world, false); clearDatabase(world, false);
@ -260,12 +259,6 @@ public class CoreProtectBridge extends FreedomService
{ {
FLog.warning("Failed to delete the CoreProtect data for the " + world.getName()); FLog.warning("Failed to delete the CoreProtect data for the " + world.getName());
} }
// This exits for flatlands wipes
if (shutdown)
{
server.shutdown();
}
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)

View File

@ -1,13 +1,20 @@
package me.totalfreedom.totalfreedommod.bridge; package me.totalfreedom.totalfreedommod.bridge;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer; import com.sk89q.worldguard.protection.regions.RegionContainer;
import java.util.Map; import java.util.Map;
import com.sk89q.worldguard.protection.regions.RegionQuery;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class WorldGuardBridge extends FreedomService public class WorldGuardBridge extends FreedomService
@ -23,6 +30,16 @@ public class WorldGuardBridge extends FreedomService
{ {
} }
public boolean canEditCurrentWorld(Player player)
{
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
return query.testBuild(localPlayer.getLocation(), localPlayer);
}
public RegionManager getRegionManager(World world) public RegionManager getRegionManager(World world)
{ {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();

View File

@ -9,8 +9,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/<command> [playername]") @CommandParameters(description = "Shows the amount of coins you or another player has. Also allows you to give coins to other players.", usage = "/<command> [player] | pay <player> <amount>")
public class Command_coins extends FreedomCommand public class Command_coins extends FreedomCommand
{ {
@Override @Override
@ -21,34 +24,119 @@ public class Command_coins extends FreedomCommand
msg("The shop is currently disabled!", ChatColor.RED); msg("The shop is currently disabled!", ChatColor.RED);
return true; return true;
} }
Player p;
final String prefix = FUtil.colorize(ConfigEntry.SHOP_PREFIX.getString() + " "); final String prefix = FUtil.colorize(ConfigEntry.SHOP_PREFIX.getString() + " ");
if (args.length > 0)
switch (args.length)
{ {
if (getPlayer(args[0]) != null) // Mode for seeing how many coins the sender has (doesn't work from console)
case 0:
{ {
p = getPlayer(args[0]); if (senderIsConsole)
} {
else msg("When used from the console, you must define a target player.");
{ }
msg(PLAYER_NOT_FOUND); else
{
PlayerData playerData = getData(playerSender);
msg(prefix + ChatColor.GREEN + "You have " + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN
+ " coins.");
}
return true; return true;
} }
}
else // Mode for seeing how many coins a player has.
{ case 1:
if (senderIsConsole)
{ {
msg(prefix + ChatColor.RED + "You are not a player, use /coins <playername>"); Player target = getPlayer(args[0]);
if (target == null)
{
msg(PLAYER_NOT_FOUND);
}
else
{
PlayerData playerData = getData(target);
msg(prefix + ChatColor.GREEN + target.getName() + " has " + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN + " coins.");
}
return true; return true;
} }
else
// Mode for paying another player coins
case 3:
{ {
p = playerSender; if (args[0].equalsIgnoreCase("pay"))
{
checkPlayer();
final Player target = getPlayer(args[1]);
final PlayerData senderData = getData(playerSender);
int coinsToTransfer;
// Processes args[2]
try
{
// Prevents players from trying to be cheeky with negative numbers.
coinsToTransfer = Math.max(Math.abs(Integer.parseInt(args[2])), 1);
}
catch (NumberFormatException ex)
{
msg("Invalid number: " + args[2], ChatColor.RED);
return true;
}
// Prevents players from performing transactions they can't afford to do.
if (senderData.getCoins() < coinsToTransfer)
{
msg("You don't have enough coins to perform this transaction.", ChatColor.RED);
return true;
}
if (target == null)
{
msg(PLAYER_NOT_FOUND);
}
else
{
PlayerData playerData = getData(target);
playerData.setCoins(playerData.getCoins() + coinsToTransfer);
senderData.setCoins(senderData.getCoins() - coinsToTransfer);
msg(target, sender.getName()
+ ChatColor.GREEN + " has given you "
+ ChatColor.GOLD + coinsToTransfer
+ ChatColor.GREEN + " coin" + (coinsToTransfer > 1 ? "s" : "") + "!", ChatColor.GOLD);
msg("You have given "
+ ChatColor.GOLD + coinsToTransfer
+ ChatColor.GREEN + " coin" + (coinsToTransfer > 1 ? "s" : "")
+ " to " + ChatColor.GOLD + target.getName() + ChatColor.GREEN + ".", ChatColor.GREEN);
}
return true;
}
}
default:
{
return false;
} }
} }
PlayerData playerData = plugin.pl.getData(p); }
msg(prefix + ChatColor.GREEN + (args.length > 0 ? p.getName() + " has " : "You have ") + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN + " coins.");
return true; @Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1)
{
List<String> options = new ArrayList<>(FUtil.getPlayerList());
options.add("pay");
return options;
}
return FUtil.getPlayerList();
} }
} }

View File

@ -5,13 +5,13 @@ import java.util.List;
import java.util.SplittableRandom; import java.util.SplittableRandom;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.v1_16_R3.NBTTagList; import net.minecraft.nbt.NBTTagList;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -151,7 +151,7 @@ public class Command_modifyitem extends FreedomCommand
{ {
return false; return false;
} }
net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(item); net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound(); NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = getAttributeList(nmsStack); NBTTagList modifiers = getAttributeList(nmsStack);
NBTTagCompound cmpnd = new NBTTagCompound(); NBTTagCompound cmpnd = new NBTTagCompound();
@ -202,7 +202,7 @@ public class Command_modifyitem extends FreedomCommand
return true; return true;
} }
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R3.ItemStack stack) private NBTTagList getAttributeList(net.minecraft.world.item.ItemStack stack)
{ {
if (stack.getTag() == null) if (stack.getTag() == null)
{ {

View File

@ -130,17 +130,19 @@ public class Command_mute extends FreedomCommand
{ {
playerdata.setMuted(true); playerdata.setMuted(true);
player.sendTitle(ChatColor.RED + "You've been muted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60); player.sendTitle(ChatColor.RED + "You've been muted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
if (quiet)
{
msg("Muted " + player.getName() + " quietly");
return true; // doesn't announce reason
}
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
if (reason != null) if (reason != null)
{ {
msg(player, ChatColor.RED + "Reason: " + ChatColor.YELLOW + reason); msg(player, ChatColor.RED + "Reason: " + ChatColor.YELLOW + reason);
} }
if (quiet)
{
msg("Muted " + player.getName() + " quietly");
return true;
}
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
if (smite) if (smite)
{ {
@ -178,4 +180,4 @@ public class Command_mute extends FreedomCommand
return Collections.emptyList(); return Collections.emptyList();
} }
} }

View File

@ -24,6 +24,10 @@ public class Command_opall extends FreedomCommand
msg(player, YOU_ARE_OP); msg(player, YOU_ARE_OP);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
} }
else
{
player.recalculatePermissions();
}
} }
return true; return true;

View File

@ -1,6 +1,8 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import java.util.List; import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.EnumUtils;
@ -55,6 +57,7 @@ public class Command_spawnmob extends FreedomCommand
return true; return true;
} }
int max = ConfigEntry.SPAWNMOB_MAX.getInteger();
int amount = 1; int amount = 1;
if (args.length > 1) if (args.length > 1)
{ {
@ -69,9 +72,9 @@ public class Command_spawnmob extends FreedomCommand
} }
} }
if (amount > 10 || amount < 1) if (amount > max || amount < 1)
{ {
msg("Invalid amount: " + args[1] + ". Must be 1-10.", ChatColor.RED); msg("Invalid amount: " + args[1] + ". Must be 1-" + max + ".", ChatColor.RED);
return true; return true;
} }

View File

@ -1,11 +1,13 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.shop.ShopItem;
import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Trails rainbow wool behind you as you walk/fly.", usage = "/<command>") @CommandParameters(description = "Trails rainbow wool behind you as you walk/fly.", usage = "/<command>")
public class Command_trail extends FreedomCommand public class Command_trail extends FreedomCommand
{ {
@ -13,6 +15,12 @@ public class Command_trail extends FreedomCommand
@Override @Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.RAINBOW_TRAIL))
{
msg("You didn't purchase the ability to have a " + ShopItem.RAINBOW_TRAIL.getName() + "! Purchase it from the shop.", ChatColor.RED);
return true;
}
if (plugin.tr.contains(playerSender)) if (plugin.tr.contains(playerSender))
{ {
plugin.tr.remove(playerSender); plugin.tr.remove(playerSender);
@ -21,7 +29,7 @@ public class Command_trail extends FreedomCommand
else else
{ {
plugin.tr.add(playerSender); plugin.tr.add(playerSender);
msg("Trail enabled. Use \"/trail off\" to disable."); msg("Trail enabled. Run this command again to disable it.");
} }
return true; return true;

View File

@ -45,6 +45,8 @@ public enum ConfigEntry
MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"), MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"),
MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"), MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"),
// //
SPAWNMOB_MAX(Integer.class, "spawnmob.max"),
//
HTTPD_ENABLED(Boolean.class, "httpd.enabled"), HTTPD_ENABLED(Boolean.class, "httpd.enabled"),
HTTPD_HOST(String.class, "httpd.host"), HTTPD_HOST(String.class, "httpd.host"),
HTTPD_PORT(Integer.class, "httpd.port"), HTTPD_PORT(Integer.class, "httpd.port"),
@ -86,6 +88,7 @@ public enum ConfigEntry
DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID(String.class, "discord.assistant_executive_role_id"), DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID(String.class, "discord.assistant_executive_role_id"),
DISCORD_EXECUTIVE_ROLE_ID(String.class, "discord.executive_role_id"), DISCORD_EXECUTIVE_ROLE_ID(String.class, "discord.executive_role_id"),
DISCORD_SERVER_OWNER_ROLE_ID(String.class, "discord.server_owner_role_id"), DISCORD_SERVER_OWNER_ROLE_ID(String.class, "discord.server_owner_role_id"),
DISCORD_INVITE_LINK(String.class, "discord.invite_link"),
// //
PTERO_URL(String.class, "ptero.url"), PTERO_URL(String.class, "ptero.url"),
PTERO_DEFAULT_EMAIL_DOMAIN(String.class, "ptero.default_email_domain"), PTERO_DEFAULT_EMAIL_DOMAIN(String.class, "ptero.default_email_domain"),
@ -110,6 +113,7 @@ public enum ConfigEntry
SHOP_PRICES_STACKING_POTATO(Integer.class, "shop.prices.stacking_potato"), SHOP_PRICES_STACKING_POTATO(Integer.class, "shop.prices.stacking_potato"),
SHOP_PRICES_CLOWN_FISH(Integer.class, "shop.prices.clown_fish"), SHOP_PRICES_CLOWN_FISH(Integer.class, "shop.prices.clown_fish"),
SHOP_PRICES_LOGIN_MESSAGES(Integer.class, "shop.prices.login_messages"), SHOP_PRICES_LOGIN_MESSAGES(Integer.class, "shop.prices.login_messages"),
SHOP_PRICES_RAINBOW_TRAIL(Integer.class, "shop.prices.rainbow_trail"),
// //
ADMINLIST_CLEAN_THESHOLD_HOURS(Integer.class, "adminlist.clean_threshold_hours"), ADMINLIST_CLEAN_THESHOLD_HOURS(Integer.class, "adminlist.clean_threshold_hours"),
ADMINLIST_CONSOLE_IS_ADMIN(Boolean.class, "adminlist.console_is_admin"), ADMINLIST_CONSOLE_IS_ADMIN(Boolean.class, "adminlist.console_is_admin"),

View File

@ -10,9 +10,12 @@ import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -28,39 +31,66 @@ public class DiscordToMinecraftListener extends ListenerAdapter
{ {
Member member = event.getMember(); Member member = event.getMember();
String tag = getDisplay(member); String tag = getDisplay(member);
StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "]");
Message msg = event.getMessage(); Message msg = event.getMessage();
ComponentBuilder emsg = new ComponentBuilder();
// Prefix
emsg.append(ChatColor.DARK_GRAY + "[");
TextComponent inviteLink = new TextComponent("Discord");
inviteLink.setColor(ChatColor.DARK_AQUA.asBungee());
inviteLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new Text("Click here to get the invite link!")));
inviteLink.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL,
ConfigEntry.DISCORD_INVITE_LINK.getString()));
emsg.append(inviteLink);
emsg.append(ChatColor.DARK_GRAY + "] ", ComponentBuilder.FormatRetention.NONE);
// Tag (if they have one)
if (tag != null) if (tag != null)
{ {
message.append(" ").append(tag); emsg.append(tag);
}
message.append(" ").append(ChatColor.RED).append(ChatColor.stripColor(member.getEffectiveName())).append(ChatColor.DARK_GRAY).append(":").append(ChatColor.RESET);
ComponentBuilder builder = new ComponentBuilder(message.toString());
if (!msg.getContentDisplay().isEmpty())
{
builder.append(" ").append(ChatColor.stripColor(msg.getContentDisplay()));
message.append(" ").append(ChatColor.stripColor(msg.getContentDisplay())); // for logging
} }
emsg.append(" ");
// User
TextComponent user = new TextComponent(ChatColor.stripColor(member.getEffectiveName()));
user.setColor(ChatColor.RED.asBungee());
emsg.append(user);
// Message
emsg.append(ChatColor.DARK_GRAY + ": " + ChatColor.RESET
+ ChatColor.stripColor(msg.getContentDisplay()), ComponentBuilder.FormatRetention.NONE);
// Attachments
if (!msg.getAttachments().isEmpty()) if (!msg.getAttachments().isEmpty())
{ {
if (!msg.getContentDisplay().isEmpty())
emsg.append(" ");
for (Message.Attachment attachment : msg.getAttachments()) for (Message.Attachment attachment : msg.getAttachments())
{ {
attachment.getUrl(); TextComponent media = new TextComponent("[Media] ");
builder.append(" "); media.setColor(ChatColor.YELLOW.asBungee());
TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]"); media.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl())); media.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(attachment.getUrl())));
builder.append(text);
message.append(" [Media]"); // for logging emsg.append(media, ComponentBuilder.FormatRetention.NONE);
} }
} }
BaseComponent[] components = emsg.create();
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord()) if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
{ {
player.spigot().sendMessage(builder.create()); player.spigot().sendMessage(components);
} }
} }
FLog.info(message.toString());
FLog.info(TextComponent.toLegacyText(components), true);
} }
} }
} }

View File

@ -4,7 +4,10 @@ import java.util.HashSet;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.SplittableRandom; import java.util.SplittableRandom;
import java.util.UUID;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.shop.ShopItem;
import me.totalfreedom.totalfreedommod.util.Groups; import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -18,7 +21,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
public class Trailer extends FreedomService public class Trailer extends FreedomService
{ {
private final SplittableRandom random = new SplittableRandom(); private final SplittableRandom random = new SplittableRandom();
private final Set<String> trailPlayers = new HashSet<>(); // player name private final Set<UUID> trailPlayers = new HashSet<>(); // player UUID
@Override @Override
public void onStart() public void onStart()
@ -33,17 +36,17 @@ public class Trailer extends FreedomService
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) public void onPlayerMove(PlayerMoveEvent event)
{ {
if (trailPlayers.isEmpty()) /* Doesn't continue any further if...
{ * - The trail list is empty
return; * - The player doesn't have their trail enabled in the first place
} * - The player doesn't have the trail item in the shop at all
* - The player doesn't have permission to modify blocks in their current world
if (!trailPlayers.contains(event.getPlayer().getName())) */
{ if (trailPlayers.isEmpty()
return; || !trailPlayers.contains(event.getPlayer().getUniqueId())
} || !plugin.pl.getData(event.getPlayer()).hasItem(ShopItem.RAINBOW_TRAIL)
|| plugin.wr.doRestrict(event.getPlayer())
if (event.getPlayer().getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) || !plugin.wgb.canEditCurrentWorld(event.getPlayer()))
{ {
return; return;
} }
@ -69,7 +72,7 @@ public class Trailer extends FreedomService
{ {
final Location trail_pos; final Location trail_pos;
trail_pos = new Location(event.getPlayer().getWorld(), fromBlock.getX() + x, fromBlock.getY(), fromBlock.getZ() + z); trail_pos = new Location(event.getPlayer().getWorld(), fromBlock.getX() + x, fromBlock.getY(), fromBlock.getZ() + z);
if (trailPlayers.contains(event.getPlayer().getName()) && plugin.cpb.isEnabled()) if (trailPlayers.contains(event.getPlayer().getUniqueId()) && plugin.cpb.isEnabled())
{ {
plugin.cpb.getCoreProtectAPI().logPlacement(event.getPlayer().getName(), trail_pos, material, data); plugin.cpb.getCoreProtectAPI().logPlacement(event.getPlayer().getName(), trail_pos, material, data);
} }
@ -79,16 +82,16 @@ public class Trailer extends FreedomService
public void remove(Player player) public void remove(Player player)
{ {
trailPlayers.remove(player.getName()); trailPlayers.remove(player.getUniqueId());
} }
public void add(Player player) public void add(Player player)
{ {
trailPlayers.add(player.getName()); trailPlayers.add(player.getUniqueId());
} }
public boolean contains(Player player) public boolean contains(Player player)
{ {
return trailPlayers.contains(player.getName()); return trailPlayers.contains(player.getUniqueId());
} }
} }

View File

@ -337,12 +337,12 @@ public abstract class NanoHTTPD
*/ */
protected String decodePercent(String str) protected String decodePercent(String str)
{ {
String decoded = null; String decoded = str;
try try
{ {
decoded = URLDecoder.decode(str, "UTF8"); decoded = URLDecoder.decode(str, "UTF8");
} }
catch (UnsupportedEncodingException ignored) catch (UnsupportedEncodingException | IllegalArgumentException ignored)
{ {
} }
return decoded; return decoded;

View File

@ -10,19 +10,29 @@ public enum ShopItem
LIGHTNING_ROD("Lightning Rod", Material.BLAZE_ROD, 12, ConfigEntry.SHOP_PRICES_LIGHTNING_ROD, ChatColor.LIGHT_PURPLE, "lightningRod", "/lightningrod"), LIGHTNING_ROD("Lightning Rod", Material.BLAZE_ROD, 12, ConfigEntry.SHOP_PRICES_LIGHTNING_ROD, ChatColor.LIGHT_PURPLE, "lightningRod", "/lightningrod"),
FIRE_BALL("Fire Ball", Material.FIRE_CHARGE, 14, ConfigEntry.SHOP_PRICES_FIRE_BALL, ChatColor.RED, "fireBall", "/fireball"), FIRE_BALL("Fire Ball", Material.FIRE_CHARGE, 14, ConfigEntry.SHOP_PRICES_FIRE_BALL, ChatColor.RED, "fireBall", "/fireball"),
RIDEABLE_PEARL("Rideable Ender Pearl", Material.ENDER_PEARL, 16, ConfigEntry.SHOP_PRICES_RIDEABLE_PEARL, ChatColor.DARK_PURPLE, "rideablePearl", "/rideablepearl"), RIDEABLE_PEARL("Rideable Ender Pearl", Material.ENDER_PEARL, 16, ConfigEntry.SHOP_PRICES_RIDEABLE_PEARL, ChatColor.DARK_PURPLE, "rideablePearl", "/rideablepearl"),
STACKING_POTATO("Stacking Potato", Material.POTATO, 20, ConfigEntry.SHOP_PRICES_STACKING_POTATO, ChatColor.YELLOW, "stackingPotato", "/stackingpotato"), STACKING_POTATO("Stacking Potato", Material.POTATO, 19, ConfigEntry.SHOP_PRICES_STACKING_POTATO, ChatColor.YELLOW, "stackingPotato", "/stackingpotato"),
CLOWN_FISH("Clown Fish", Material.TROPICAL_FISH, 22, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish"), CLOWN_FISH("Clown Fish", Material.TROPICAL_FISH, 21, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish"),
LOGIN_MESSAGES("Login Messages", Material.NAME_TAG, 24, ConfigEntry.SHOP_PRICES_LOGIN_MESSAGES, ChatColor.DARK_GREEN, "loginMessages", "/loginmessage"); LOGIN_MESSAGES("Login Messages", Material.NAME_TAG, 23, ConfigEntry.SHOP_PRICES_LOGIN_MESSAGES, ChatColor.DARK_GREEN, "loginMessages", "/loginmessage"),
RAINBOW_TRAIL("Rainbow Trail", Material.RED_WOOL, 25, ConfigEntry.SHOP_PRICES_RAINBOW_TRAIL, ChatColor.DARK_RED, "rainbowTrail", "/trail");
/* /*
Shop GUI Layout: Shop GUI Layout:
Dimensions: 9x4 = 36 Dimensions: 9x4 = 36
Key: g = Grappling Hook, l = Lightning Rod, f = Fire Ball, r = Rideable Ender Pearl, s = Stacking Potato, c = Clown Fish, x = Login Messages $ = Coins} Key:
g = Grappling Hook,
l = Lightning Rod
f = Fire Ball
r = Rideable Ender Pearl
s = Stacking Potato
c = Clown Fish
x = Login Messages
t = Rainbow Trail
$ = Coins
--------- ---------
-g-l-f-r- -g-l-f-r-
--s-c-x-- -s-c-x-t-
--------$ --------$
*/ */

View File

@ -36,8 +36,6 @@ import static org.bukkit.Bukkit.getServer;
public class FUtil public class FUtil
{ {
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
/* See https://github.com/TotalFreedom/License - None of the listed names may be removed. /* See https://github.com/TotalFreedom/License - None of the listed names may be removed.
Leaving this list here for anyone running TFM on a cracked server: Leaving this list here for anyone running TFM on a cracked server:
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "Telesphoreo", "CoolJWB"); public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "Telesphoreo", "CoolJWB");
@ -754,7 +752,7 @@ public class FUtil
public static String getIp(Player player) public static String getIp(Player player)
{ {
return Objects.requireNonNull(player.getAddress()).getAddress().getHostAddress().trim(); return player.getAddress().getAddress().getHostAddress().trim();
} }
public static String getIp(PlayerLoginEvent event) public static String getIp(PlayerLoginEvent event)

View File

@ -45,140 +45,9 @@ public class Groups
Material.LIGHT_GRAY_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX,
Material.BLACK_SHULKER_BOX); Material.BLACK_SHULKER_BOX);
public static final List<EntityType> MOB_TYPES = Arrays.asList( public static final List<EntityType> MOB_TYPES = Arrays.stream(EntityType.values()).filter(EntityType::isAlive).filter(EntityType::isSpawnable).toList();
EntityType.BAT,
EntityType.BEE,
EntityType.BLAZE,
EntityType.CAVE_SPIDER,
EntityType.CHICKEN,
EntityType.CAT,
EntityType.COD,
EntityType.COW,
EntityType.CREEPER,
EntityType.DOLPHIN,
EntityType.DONKEY,
EntityType.DROWNED,
EntityType.ELDER_GUARDIAN,
EntityType.ENDERMAN,
EntityType.ENDERMITE,
EntityType.EVOKER,
EntityType.FOX,
EntityType.GHAST,
EntityType.GUARDIAN,
EntityType.HOGLIN,
EntityType.HORSE,
EntityType.HUSK,
EntityType.ILLUSIONER,
EntityType.IRON_GOLEM,
EntityType.LLAMA,
EntityType.MAGMA_CUBE,
EntityType.MUSHROOM_COW,
EntityType.MULE,
EntityType.OCELOT,
EntityType.PANDA,
EntityType.PARROT,
EntityType.PHANTOM,
EntityType.PIG,
EntityType.PIGLIN,
EntityType.PIGLIN_BRUTE,
EntityType.PILLAGER,
EntityType.POLAR_BEAR,
EntityType.PUFFERFISH,
EntityType.RABBIT,
EntityType.RAVAGER,
EntityType.SALMON,
EntityType.SHEEP,
EntityType.SHULKER,
EntityType.SILVERFISH,
EntityType.SKELETON,
EntityType.SKELETON_HORSE,
EntityType.SLIME,
EntityType.SNOWMAN,
EntityType.SPIDER,
EntityType.SQUID,
EntityType.STRAY,
EntityType.STRIDER,
EntityType.TRADER_LLAMA,
EntityType.TROPICAL_FISH,
EntityType.TURTLE,
EntityType.VEX,
EntityType.VILLAGER,
EntityType.VINDICATOR,
EntityType.WANDERING_TRADER,
EntityType.WITCH,
EntityType.WITHER_SKELETON,
EntityType.WOLF,
EntityType.ZOGLIN,
EntityType.ZOMBIE,
EntityType.ZOMBIE_HORSE,
EntityType.ZOMBIFIED_PIGLIN,
EntityType.ZOMBIE_VILLAGER);
public static final List<Material> SPAWN_EGGS = Arrays.asList( public static final List<Material> SPAWN_EGGS = Arrays.stream(Material.values()).filter((mat) -> mat.name().endsWith("_SPAWN_EGG")).toList();
Material.BAT_SPAWN_EGG,
Material.BEE_SPAWN_EGG,
Material.BLAZE_SPAWN_EGG,
Material.CAVE_SPIDER_SPAWN_EGG,
Material.CHICKEN_SPAWN_EGG,
Material.CAT_SPAWN_EGG,
Material.COD_SPAWN_EGG,
Material.COW_SPAWN_EGG,
Material.CREEPER_SPAWN_EGG,
Material.DOLPHIN_SPAWN_EGG,
Material.DONKEY_SPAWN_EGG,
Material.DROWNED_SPAWN_EGG,
Material.ELDER_GUARDIAN_SPAWN_EGG,
Material.ENDERMAN_SPAWN_EGG,
Material.ENDERMITE_SPAWN_EGG,
Material.EVOKER_SPAWN_EGG,
Material.FOX_SPAWN_EGG,
Material.GHAST_SPAWN_EGG,
Material.GUARDIAN_SPAWN_EGG,
Material.HOGLIN_SPAWN_EGG,
Material.HORSE_SPAWN_EGG,
Material.HUSK_SPAWN_EGG,
Material.LLAMA_SPAWN_EGG,
Material.MAGMA_CUBE_SPAWN_EGG,
Material.MOOSHROOM_SPAWN_EGG,
Material.MULE_SPAWN_EGG,
Material.OCELOT_SPAWN_EGG,
Material.PANDA_SPAWN_EGG,
Material.PARROT_SPAWN_EGG,
Material.PHANTOM_SPAWN_EGG,
Material.PIG_SPAWN_EGG,
Material.PIGLIN_SPAWN_EGG,
Material.PIGLIN_BRUTE_SPAWN_EGG,
Material.PILLAGER_SPAWN_EGG,
Material.POLAR_BEAR_SPAWN_EGG,
Material.PUFFERFISH_SPAWN_EGG,
Material.RABBIT_SPAWN_EGG,
Material.RAVAGER_SPAWN_EGG,
Material.SALMON_SPAWN_EGG,
Material.SHEEP_SPAWN_EGG,
Material.SHULKER_SPAWN_EGG,
Material.SILVERFISH_SPAWN_EGG,
Material.SKELETON_SPAWN_EGG,
Material.SKELETON_HORSE_SPAWN_EGG,
Material.SLIME_SPAWN_EGG,
Material.SPIDER_SPAWN_EGG,
Material.SQUID_SPAWN_EGG,
Material.STRAY_SPAWN_EGG,
Material.STRIDER_SPAWN_EGG,
Material.TRADER_LLAMA_SPAWN_EGG,
Material.TROPICAL_FISH_SPAWN_EGG,
Material.TURTLE_SPAWN_EGG,
Material.VEX_SPAWN_EGG,
Material.VILLAGER_SPAWN_EGG,
Material.VINDICATOR_SPAWN_EGG,
Material.WANDERING_TRADER_SPAWN_EGG,
Material.WITCH_SPAWN_EGG,
Material.WITHER_SKELETON_SPAWN_EGG,
Material.WOLF_SPAWN_EGG,
Material.ZOGLIN_SPAWN_EGG,
Material.ZOMBIE_SPAWN_EGG,
Material.ZOMBIE_HORSE_SPAWN_EGG,
Material.ZOMBIFIED_PIGLIN_SPAWN_EGG,
Material.ZOMBIE_VILLAGER_SPAWN_EGG);
public static final List<Material> BANNERS = Arrays.asList( public static final List<Material> BANNERS = Arrays.asList(
Material.BLACK_BANNER, Material.BLACK_BANNER,

View File

@ -1,9 +1,6 @@
package me.totalfreedom.totalfreedommod.world; package me.totalfreedom.totalfreedommod.world;
import java.io.File;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -32,8 +29,6 @@ public class Flatlands extends CustomWorld
return null; return null;
} }
wipeFlatlandsIfFlagged();
final WorldCreator worldCreator = new WorldCreator(getName()); final WorldCreator worldCreator = new WorldCreator(getName());
worldCreator.generateStructures(false); worldCreator.generateStructures(false);
worldCreator.type(WorldType.NORMAL); worldCreator.type(WorldType.NORMAL);
@ -63,32 +58,4 @@ public class Flatlands extends CustomWorld
return world; return world;
} }
public void wipeFlatlandsIfFlagged()
{
boolean doFlatlandsWipe = false;
try
{
doFlatlandsWipe = plugin.sf.getSavedFlag("do_wipe_flatlands");
}
catch (Exception ignored)
{
}
if (doFlatlandsWipe)
{
if (Bukkit.getServer().getWorld("flatlands") == null)
{
FLog.info("Wiping flatlands.");
plugin.sf.setSavedFlag("do_wipe_flatlands", false);
FileUtils.deleteQuietly(new File("./flatlands"));
}
else
{
FLog.severe("Can't wipe flatlands, it is already loaded.");
}
}
}
} }

View File

@ -84,6 +84,8 @@ discord:
executive_role_id: '' executive_role_id: ''
# Owner role ID # Owner role ID
server_owner_role_id: '' server_owner_role_id: ''
# Invite link for your Discord server
invite_link: 'https://discord.com/invite/PW4savJR9a'
# Pterodactyl # Pterodactyl
ptero: ptero:
@ -159,6 +161,7 @@ shop:
stacking_potato: 300 stacking_potato: 300
clown_fish: 1500 clown_fish: 1500
login_messages: 5000 login_messages: 5000
rainbow_trail: 1500
# Admin list # Admin list
adminlist: adminlist:
@ -506,6 +509,10 @@ moblimiter:
slime: true slime: true
giant: true giant: true
# Spawnmob
spawnmob:
max: 25
# Flatlands # Flatlands
flatlands: flatlands:
generate: true generate: true

View File

@ -14,4 +14,4 @@ softdepend:
- JDA - JDA
- Votifier - Votifier
authors: [Madgeek1450, Prozza] authors: [Madgeek1450, Prozza]
api-version: "1.16" api-version: "1.17"