From f190bbeac10406d2a85563055c4c0e777323cb53 Mon Sep 17 00:00:00 2001 From: Video Date: Tue, 23 Nov 2021 00:27:57 -0700 Subject: [PATCH 01/10] FS-292 --- pom.xml | 12 ++++++------ .../totalfreedommod/ServerInterface.java | 15 +++++---------- .../totalfreedommod/blocking/SignBlocker.java | 6 +++--- .../command/Command_modifyitem.java | 10 +++++----- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 77a1b10f..306e9453 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ org.spigotmc spigot - 1.16.5-R0.1-SNAPSHOT + 1.17.1-R0.1-SNAPSHOT provided @@ -177,7 +177,7 @@ net.coreprotect coreprotect - 19.5 + 20.1 provided @@ -275,9 +275,9 @@ 3.8.1 TotalFreedomMod.jar - 11 - 11 - 11 + 17 + 17 + 17 @@ -401,7 +401,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.3.0-SNAPSHOT package diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java index 40abc384..3821a949 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java @@ -4,14 +4,14 @@ import java.util.Arrays; import java.util.List; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.minecraft.server.v1_16_R3.EntityPlayer; -import net.minecraft.server.v1_16_R3.MinecraftServer; +import net.minecraft.server.level.EntityPlayer; +import net.minecraft.server.MinecraftServer; 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 static final String COMPILE_NMS_VERSION = "v1_16_R3"; + public static final String COMPILE_NMS_VERSION = "v1_17_R1"; public static void warnVersion() { @@ -34,16 +34,11 @@ public class ServerInterface extends FreedomService { } - public void setOnlineMode(boolean mode) - { - getServer().setOnlineMode(mode); - } - public int purgeWhitelist() { String[] whitelisted = getServer().getPlayerList().getWhitelisted(); int size = whitelisted.length; - for (EntityPlayer player : getServer().getPlayerList().players) + for (EntityPlayer player : getServer().getPlayerList().getPlayers()) { getServer().getPlayerList().getWhitelist().remove(player.getProfile()); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/SignBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/SignBlocker.java index 261ce274..3fabc837 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/SignBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/SignBlocker.java @@ -1,10 +1,10 @@ package me.totalfreedom.totalfreedommod.blocking; 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.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.event.EventHandler; import org.bukkit.event.EventPriority; @@ -35,7 +35,7 @@ public class SignBlocker extends FreedomService if (Tag.SIGNS.getValues().contains(event.getBlock().getType())) { 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(); assert compound != null; NBTTagCompound bet = compound.getCompound("BlockEntityTag"); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_modifyitem.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_modifyitem.java index bb7d6ec7..4ba7ab88 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_modifyitem.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_modifyitem.java @@ -5,13 +5,13 @@ import java.util.List; import java.util.SplittableRandom; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.minecraft.server.v1_16_R3.NBTTagCompound; -import net.minecraft.server.v1_16_R3.NBTTagList; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; import org.bukkit.command.Command; 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.entity.Player; import org.bukkit.inventory.ItemStack; @@ -151,7 +151,7 @@ public class Command_modifyitem extends FreedomCommand { 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(); NBTTagList modifiers = getAttributeList(nmsStack); NBTTagCompound cmpnd = new NBTTagCompound(); @@ -202,7 +202,7 @@ public class Command_modifyitem extends FreedomCommand 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) { From 5849947c6b97d44f5ea828e33853eeddba32acea Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 02:35:36 -0700 Subject: [PATCH 02/10] This should fix it --- pom.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 306e9453..7d7c4aa8 100644 --- a/pom.xml +++ b/pom.xml @@ -258,6 +258,13 @@ + + + apache.snapshots + https://repository.apache.org/snapshots/ + + + @@ -401,7 +408,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.3.0-SNAPSHOT + 3.3.1-SNAPSHOT package From bf2323bed20bd0287477c98ee8c3841189a6e974 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 02:44:23 -0700 Subject: [PATCH 03/10] Squashed commit of the following: commit a42cb6aff98f97469202f686f67c010fffe8bc2c Merge: 2ecfb886 01fdf766 Author: Video Date: Mon Nov 29 02:41:34 2021 -0700 Merge pull request #125 from AtlasMediaGroup/shitcan-savedflags Shitcans SavedFlags commit 01fdf766ee831bd4f9ae1b887b75b559e1171bd7 Merge: 58c21bb1 2ecfb886 Author: Video Date: Tue Nov 23 09:28:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit 2ecfb88604dcea061b1fb142f18ca2becec8cfef Merge: 42143c11 bb2ddf11 Author: Video Date: Tue Nov 23 09:15:16 2021 -0700 Merge pull request #130 from AtlasMediaGroup/FS-215 Makes [Discord] a hyperlink (FS-215) commit bb2ddf11292cb0945d7be2c5cd012cd96aee40ff Merge: cf9fdc6f 42143c11 Author: Video Date: Tue Nov 23 03:31:19 2021 -0700 Merge branch 'development' into FS-215 commit 58c21bb1aab8b80829663343a9677cfd79d09e19 Merge: fdba119d 42143c11 Author: Video Date: Tue Nov 23 03:30:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit cf9fdc6fe4fc278c5cc46745f535bdb7dfce185b Merge: 387ea6f7 a598c933 Author: Video Date: Fri Oct 8 01:43:33 2021 -0600 Merge branch 'development' into FS-215 commit 387ea6f71e36dddcd376ac0f6a555e30a9735067 Merge: a1ecf881 180cd811 Author: Video Date: Fri Oct 1 00:35:12 2021 -0600 Merge branch 'development' into FS-215 commit a1ecf881094de1da26b181370d08bddb425b4e98 Merge: bd647afe 213a4338 Author: Ryan Date: Sun Sep 12 13:48:59 2021 +0100 Merge branch 'development' into FS-215 commit fdba119d5d7b016a9fddaa05568776f43d02d442 Merge: 61857dd0 213a4338 Author: Ryan Date: Sun Sep 12 13:48:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 61857dd06f05f1ba7242f308de671ea65f33ca80 Merge: 2d18d461 0e12f5e7 Author: Video Date: Sun Sep 12 03:01:37 2021 -0600 Merge branch 'development' into shitcan-savedflags commit bd647afe92d21e9dff65ae9c4c07323f56bfd1cd Merge: 69f17ef2 0e12f5e7 Author: Video Date: Sun Sep 12 02:50:39 2021 -0600 Merge branch 'development' into FS-215 commit 69f17ef2d742cfc77bc659c21fa0ef3007ab2337 Merge: ee1b27fa aebe1ace Author: Video Date: Sun Sep 12 02:01:56 2021 -0600 Merge branch 'development' into FS-215 commit ee1b27fa0df9ee1b579ce4ea6e0f768bb1ac7ca4 Merge: 2bdf14f3 0a9b95bf Author: Ryan Date: Sat Sep 11 01:24:00 2021 +0100 Merge branch 'development' into FS-215 commit 2d18d461fea83aef743967e10f8c6d6afd67a09c Merge: a4c81f20 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 2bdf14f38c07c70e392879e2c18be02e0c847af2 Merge: f6d46b61 44ff621d Author: Video Date: Mon Sep 6 15:26:13 2021 -0600 Merge branch 'development' into FS-215 commit a4c81f202cd041d4f084135bbd9b0a1d77cd6505 Merge: 0d09c3a5 23caa4e8 Author: Ryan Date: Sat Sep 4 01:23:06 2021 +0100 Merge branch 'development' into shitcan-savedflags commit f6d46b6178a9c135df11b5305ba6fb16404381c5 Merge: ee804d52 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:33 2021 +0100 Merge branch 'development' into FS-215 commit ee804d52ff0747fdf67398b12080f708460b402c Author: Video Date: Fri Sep 3 12:52:15 2021 -0600 Makes [Discord] a hyperlink (FS-215) I've decided to overhaul the implementation of DiscordToMinecraftListener to make it more easily workable. This overhaul allows me to implement FS-215 more easily. commit 0d09c3a550eb014793cc800021a0064aaad5e3b1 Merge: e2ccd14e 4c3f188b Author: Ryan Date: Sun Aug 29 20:09:03 2021 +0100 Merge branch 'development' into shitcan-savedflags commit e2ccd14eb383844c1bfb5d0e56e7924bb47f5997 Author: Video Date: Fri Aug 27 16:54:55 2021 -0600 Unsaves SavedFlags --- .../totalfreedommod/SavedFlags.java | 98 ------------------- .../totalfreedommod/TotalFreedomMod.java | 2 - .../bridge/CoreProtectBridge.java | 7 -- .../totalfreedommod/config/ConfigEntry.java | 1 + .../discord/DiscordToMinecraftListener.java | 64 ++++++++---- .../totalfreedommod/util/FUtil.java | 2 - .../totalfreedommod/world/Flatlands.java | 33 ------- src/main/resources/config.yml | 2 + 8 files changed, 50 insertions(+), 159 deletions(-) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java b/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java deleted file mode 100644 index a86320fa..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/SavedFlags.java +++ /dev/null @@ -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 getSavedFlags() - { - Map 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)ois.readObject(); - } - } - catch (Exception ex) - { - FLog.severe(ex); - } - } - - return flags; - } - - public boolean getSavedFlag(String flag) throws Exception - { - Boolean flagValue = null; - - Map 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 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); - } - } - -} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 9804f730..1bb8207b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -75,7 +75,6 @@ public class TotalFreedomMod extends JavaPlugin public CommandLoader cl; // Services public ServerInterface si; - public SavedFlags sf; public WorldManager wm; public LogViewer lv; public AdminList al; @@ -299,7 +298,6 @@ public class TotalFreedomMod extends JavaPlugin { // Start services si = new ServerInterface(); - sf = new SavedFlags(); wm = new WorldManager(); lv = new LogViewer(); sql = new SQLite(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java index c0a00e39..2653c8ef 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java @@ -192,7 +192,6 @@ public class CoreProtectBridge extends FreedomService return (megabytes / 1024); } - // Wipes DB for the specified world public void clearDatabase(World world) { clearDatabase(world, false); @@ -260,12 +259,6 @@ public class CoreProtectBridge extends FreedomService { 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) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 021f30f1..1e99ed5a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -86,6 +86,7 @@ public enum ConfigEntry DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID(String.class, "discord.assistant_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_INVITE_LINK(String.class, "discord.invite_link"), // PTERO_URL(String.class, "ptero.url"), PTERO_DEFAULT_EMAIL_DOMAIN(String.class, "ptero.default_email_domain"), diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java index e0f26bff..f4adf0d9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java @@ -10,9 +10,12 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; 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.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; 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.ChatColor; import org.bukkit.entity.Player; @@ -28,39 +31,66 @@ public class DiscordToMinecraftListener extends ListenerAdapter { Member member = event.getMember(); String tag = getDisplay(member); - StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "]"); 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) { - message.append(" ").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(tag); } + + 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.getContentDisplay().isEmpty()) + emsg.append(" "); + for (Message.Attachment attachment : msg.getAttachments()) { - attachment.getUrl(); - builder.append(" "); - TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]"); - text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl())); - builder.append(text); - message.append(" [Media]"); // for logging + TextComponent media = new TextComponent("[Media] "); + media.setColor(ChatColor.YELLOW.asBungee()); + media.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl())); + media.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(attachment.getUrl()))); + + emsg.append(media, ComponentBuilder.FormatRetention.NONE); } } + + BaseComponent[] components = emsg.create(); + for (Player player : Bukkit.getOnlinePlayers()) { 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); } } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index 81bae8cc..ea7a7344 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -36,8 +36,6 @@ import static org.bukkit.Bukkit.getServer; 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. Leaving this list here for anyone running TFM on a cracked server: public static final List DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "Telesphoreo", "CoolJWB"); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/world/Flatlands.java b/src/main/java/me/totalfreedom/totalfreedommod/world/Flatlands.java index 32033da5..790a6f33 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/world/Flatlands.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/world/Flatlands.java @@ -1,9 +1,6 @@ package me.totalfreedom.totalfreedommod.world; -import java.io.File; 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.ChatColor; import org.bukkit.Material; @@ -32,8 +29,6 @@ public class Flatlands extends CustomWorld return null; } - wipeFlatlandsIfFlagged(); - final WorldCreator worldCreator = new WorldCreator(getName()); worldCreator.generateStructures(false); worldCreator.type(WorldType.NORMAL); @@ -63,32 +58,4 @@ public class Flatlands extends CustomWorld 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."); - } - } - } - } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1530fbfa..06fd2f5a 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -84,6 +84,8 @@ discord: executive_role_id: '' # Owner role ID server_owner_role_id: '' + # Invite link for your Discord server + invite_link: 'https://discord.com/invite/PW4savJR9a' # Pterodactyl ptero: From a29392cab247dfcd23ed93477c41eb5facc2505e Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 03:03:00 -0700 Subject: [PATCH 04/10] Squashed commit of the following: commit 706229004c50c26b4cd2bf4fcbe5a7a889cf7b63 Merge: a42cb6af a4adfa9b Author: Video Date: Mon Nov 29 03:00:15 2021 -0700 Merge pull request #131 from AtlasMediaGroup/FS-273 Moves /rainbowtrail to the shop (FS-273) commit a4adfa9beea2d6204465209e71029500c6467052 Merge: 1b5bbd1c a42cb6af Author: Video Date: Mon Nov 29 02:46:41 2021 -0700 Merge branch 'development' into FS-273 commit a42cb6aff98f97469202f686f67c010fffe8bc2c Merge: 2ecfb886 01fdf766 Author: Video Date: Mon Nov 29 02:41:34 2021 -0700 Merge pull request #125 from AtlasMediaGroup/shitcan-savedflags Shitcans SavedFlags commit 01fdf766ee831bd4f9ae1b887b75b559e1171bd7 Merge: 58c21bb1 2ecfb886 Author: Video Date: Tue Nov 23 09:28:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit 1b5bbd1c05b38a3af14a51842f96b54ab141710d Merge: 8356e831 2ecfb886 Author: Video Date: Tue Nov 23 09:16:21 2021 -0700 Merge branch 'development' into FS-273 commit 2ecfb88604dcea061b1fb142f18ca2becec8cfef Merge: 42143c11 bb2ddf11 Author: Video Date: Tue Nov 23 09:15:16 2021 -0700 Merge pull request #130 from AtlasMediaGroup/FS-215 Makes [Discord] a hyperlink (FS-215) commit 8356e831a5188b9bdae36e3672cd3d96919111c0 Author: Video Date: Tue Nov 23 09:11:16 2021 -0700 Redundancy fix and better protection system commit ab00cb840fbb3b0aa92f7ab952776b5d6793ab6a Merge: ecce62f6 42143c11 Author: Video Date: Tue Nov 23 03:31:45 2021 -0700 Merge branch 'development' into FS-273 commit bb2ddf11292cb0945d7be2c5cd012cd96aee40ff Merge: cf9fdc6f 42143c11 Author: Video Date: Tue Nov 23 03:31:19 2021 -0700 Merge branch 'development' into FS-215 commit 58c21bb1aab8b80829663343a9677cfd79d09e19 Merge: fdba119d 42143c11 Author: Video Date: Tue Nov 23 03:30:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit ecce62f6b4dc3641d7a66a37b226305d44c938d0 Merge: d8148530 a598c933 Author: Video Date: Sat Oct 9 00:01:22 2021 -0600 Merge branch 'development' into FS-273 commit cf9fdc6fe4fc278c5cc46745f535bdb7dfce185b Merge: 387ea6f7 a598c933 Author: Video Date: Fri Oct 8 01:43:33 2021 -0600 Merge branch 'development' into FS-215 commit 387ea6f71e36dddcd376ac0f6a555e30a9735067 Merge: a1ecf881 180cd811 Author: Video Date: Fri Oct 1 00:35:12 2021 -0600 Merge branch 'development' into FS-215 commit d81485303659656a1f1c215d3b505b6a7e63925f Merge: 47e63869 213a4338 Author: Ryan Date: Sun Sep 12 13:49:05 2021 +0100 Merge branch 'development' into FS-273 commit a1ecf881094de1da26b181370d08bddb425b4e98 Merge: bd647afe 213a4338 Author: Ryan Date: Sun Sep 12 13:48:59 2021 +0100 Merge branch 'development' into FS-215 commit fdba119d5d7b016a9fddaa05568776f43d02d442 Merge: 61857dd0 213a4338 Author: Ryan Date: Sun Sep 12 13:48:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 61857dd06f05f1ba7242f308de671ea65f33ca80 Merge: 2d18d461 0e12f5e7 Author: Video Date: Sun Sep 12 03:01:37 2021 -0600 Merge branch 'development' into shitcan-savedflags commit bd647afe92d21e9dff65ae9c4c07323f56bfd1cd Merge: 69f17ef2 0e12f5e7 Author: Video Date: Sun Sep 12 02:50:39 2021 -0600 Merge branch 'development' into FS-215 commit 69f17ef2d742cfc77bc659c21fa0ef3007ab2337 Merge: ee1b27fa aebe1ace Author: Video Date: Sun Sep 12 02:01:56 2021 -0600 Merge branch 'development' into FS-215 commit ee1b27fa0df9ee1b579ce4ea6e0f768bb1ac7ca4 Merge: 2bdf14f3 0a9b95bf Author: Ryan Date: Sat Sep 11 01:24:00 2021 +0100 Merge branch 'development' into FS-215 commit 2d18d461fea83aef743967e10f8c6d6afd67a09c Merge: a4c81f20 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 47e638690731402f3f859168ad3eb601608b38bf Merge: b1062fbb 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:13 2021 +0100 Merge branch 'development' into FS-273 commit 2bdf14f38c07c70e392879e2c18be02e0c847af2 Merge: f6d46b61 44ff621d Author: Video Date: Mon Sep 6 15:26:13 2021 -0600 Merge branch 'development' into FS-215 commit b1062fbb6c8587317cc5c107da0357873559e0a3 Merge: f69feed4 44ff621d Author: Video Date: Mon Sep 6 14:39:32 2021 -0600 Merge branch 'development' into FS-273 commit f69feed469da5cb1852e96b68b742f261a3652ff Author: Video Date: Mon Sep 6 01:14:21 2021 -0600 fixed commit 8253f94ac4d71e068d687c87c76bdba13a9b6553 Merge: daf0126f 54cb0cfa Author: Video Date: Mon Sep 6 01:12:00 2021 -0600 Merge branch 'development' into FS-273 commit a4c81f202cd041d4f084135bbd9b0a1d77cd6505 Merge: 0d09c3a5 23caa4e8 Author: Ryan Date: Sat Sep 4 01:23:06 2021 +0100 Merge branch 'development' into shitcan-savedflags commit daf0126f4560c9c75f68e3e302f4fb2b41bd7dd3 Merge: a51f5c9b 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:39 2021 +0100 Merge branch 'development' into FS-273 commit f6d46b6178a9c135df11b5305ba6fb16404381c5 Merge: ee804d52 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:33 2021 +0100 Merge branch 'development' into FS-215 commit a51f5c9bbfae2665b229e6ffff267ddbe9a956d4 Author: Video Date: Fri Sep 3 13:53:33 2021 -0600 FS-273 commit ee804d52ff0747fdf67398b12080f708460b402c Author: Video Date: Fri Sep 3 12:52:15 2021 -0600 Makes [Discord] a hyperlink (FS-215) I've decided to overhaul the implementation of DiscordToMinecraftListener to make it more easily workable. This overhaul allows me to implement FS-215 more easily. commit 0d09c3a550eb014793cc800021a0064aaad5e3b1 Merge: e2ccd14e 4c3f188b Author: Ryan Date: Sun Aug 29 20:09:03 2021 +0100 Merge branch 'development' into shitcan-savedflags commit e2ccd14eb383844c1bfb5d0e56e7924bb47f5997 Author: Video Date: Fri Aug 27 16:54:55 2021 -0600 Unsaves SavedFlags --- .../bridge/WorldGuardBridge.java | 17 +++++++++ .../command/Command_trail.java | 12 +++++-- .../totalfreedommod/config/ConfigEntry.java | 1 + .../totalfreedommod/fun/Trailer.java | 35 ++++++++++--------- .../totalfreedommod/shop/ShopItem.java | 20 ++++++++--- src/main/resources/config.yml | 1 + 6 files changed, 63 insertions(+), 23 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java index 6bc0ab9b..ea03b670 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldGuardBridge.java @@ -1,13 +1,20 @@ package me.totalfreedom.totalfreedommod.bridge; 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.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.protection.flags.Flags; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.RegionContainer; import java.util.Map; + +import com.sk89q.worldguard.protection.regions.RegionQuery; import me.totalfreedom.totalfreedommod.FreedomService; import org.bukkit.World; +import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; 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) { RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java index 44129bd4..16d82e97 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java @@ -1,11 +1,13 @@ package me.totalfreedom.totalfreedommod.command; 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.CommandSender; 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 = "/") public class Command_trail extends FreedomCommand { @@ -13,6 +15,12 @@ public class Command_trail extends FreedomCommand @Override 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)) { plugin.tr.remove(playerSender); @@ -21,7 +29,7 @@ public class Command_trail extends FreedomCommand else { plugin.tr.add(playerSender); - msg("Trail enabled. Use \"/trail off\" to disable."); + msg("Trail enabled. Run this command again to disable it."); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 1e99ed5a..86fb22a3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -111,6 +111,7 @@ public enum ConfigEntry SHOP_PRICES_STACKING_POTATO(Integer.class, "shop.prices.stacking_potato"), SHOP_PRICES_CLOWN_FISH(Integer.class, "shop.prices.clown_fish"), 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_CONSOLE_IS_ADMIN(Boolean.class, "adminlist.console_is_admin"), diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java index 012dc4d7..e603b242 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java @@ -4,7 +4,10 @@ import java.util.HashSet; import java.util.Objects; import java.util.Set; import java.util.SplittableRandom; +import java.util.UUID; + import me.totalfreedom.totalfreedommod.FreedomService; +import me.totalfreedom.totalfreedommod.shop.ShopItem; import me.totalfreedom.totalfreedommod.util.Groups; import org.bukkit.Location; import org.bukkit.Material; @@ -18,7 +21,7 @@ import org.bukkit.event.player.PlayerMoveEvent; public class Trailer extends FreedomService { private final SplittableRandom random = new SplittableRandom(); - private final Set trailPlayers = new HashSet<>(); // player name + private final Set trailPlayers = new HashSet<>(); // player UUID @Override public void onStart() @@ -33,17 +36,17 @@ public class Trailer extends FreedomService @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerMove(PlayerMoveEvent event) { - if (trailPlayers.isEmpty()) - { - return; - } - - if (!trailPlayers.contains(event.getPlayer().getName())) - { - return; - } - - if (event.getPlayer().getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) + /* Doesn't continue any further if... + * - The trail list is empty + * - 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.isEmpty() + || !trailPlayers.contains(event.getPlayer().getUniqueId()) + || !plugin.pl.getData(event.getPlayer()).hasItem(ShopItem.RAINBOW_TRAIL) + || plugin.wr.doRestrict(event.getPlayer()) + || !plugin.wgb.canEditCurrentWorld(event.getPlayer())) { return; } @@ -69,7 +72,7 @@ public class Trailer extends FreedomService { final Location trail_pos; 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); } @@ -79,16 +82,16 @@ public class Trailer extends FreedomService public void remove(Player player) { - trailPlayers.remove(player.getName()); + trailPlayers.remove(player.getUniqueId()); } public void add(Player player) { - trailPlayers.add(player.getName()); + trailPlayers.add(player.getUniqueId()); } public boolean contains(Player player) { - return trailPlayers.contains(player.getName()); + return trailPlayers.contains(player.getUniqueId()); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/shop/ShopItem.java b/src/main/java/me/totalfreedom/totalfreedommod/shop/ShopItem.java index 4ce94dd5..fe3bb097 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/shop/ShopItem.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/shop/ShopItem.java @@ -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"), 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"), - STACKING_POTATO("Stacking Potato", Material.POTATO, 20, 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"), - LOGIN_MESSAGES("Login Messages", Material.NAME_TAG, 24, ConfigEntry.SHOP_PRICES_LOGIN_MESSAGES, ChatColor.DARK_GREEN, "loginMessages", "/loginmessage"); + STACKING_POTATO("Stacking Potato", Material.POTATO, 19, ConfigEntry.SHOP_PRICES_STACKING_POTATO, ChatColor.YELLOW, "stackingPotato", "/stackingpotato"), + CLOWN_FISH("Clown Fish", Material.TROPICAL_FISH, 21, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish"), + 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: 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- - --s-c-x-- + -s-c-x-t- --------$ */ diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 06fd2f5a..b8dbaaf2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -161,6 +161,7 @@ shop: stacking_potato: 300 clown_fish: 1500 login_messages: 5000 + rainbow_trail: 1500 # Admin list adminlist: From e9ba958a4e4948bff89e738072b9a71cf4cb8309 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 06:40:26 -0700 Subject: [PATCH 05/10] Squashed commit of the following: commit 35965b0b1076273e8a16247694802cb427622e1d Merge: aa20a6e5 1253732f Author: Video Date: Mon Nov 29 06:31:11 2021 -0700 Merge pull request #174 from AtlasMediaGroup/FS-256 Forces the server to recalculate the permissions server-wide in /opall (FS-256) commit 1253732f7740ff5ad656d4f9d7e0354a7466f69e Merge: e1bee321 aa20a6e5 Author: Video Date: Mon Nov 29 06:25:25 2021 -0700 Merge branch 'development' into FS-256 commit aa20a6e579cb1cc147d231d65891b911fbf25a08 Merge: 70622900 1ecfb0b0 Author: Video Date: Mon Nov 29 06:23:57 2021 -0700 Merge pull request #129 from AtlasMediaGroup/FS-7 Allow players to pay other players coins [FS-7] commit e1bee32163aa015d6d61b9d6a019a261c6602731 Author: Video Date: Mon Nov 29 03:27:07 2021 -0700 Forces the server to recalculate the permissions server-wide in /opall commit 1ecfb0b0660d88c3f8223dc80cd127891fa51dbf Merge: 225ade87 70622900 Author: Video Date: Mon Nov 29 03:01:22 2021 -0700 Merge branch 'development' into FS-7 commit 706229004c50c26b4cd2bf4fcbe5a7a889cf7b63 Merge: a42cb6af a4adfa9b Author: Video Date: Mon Nov 29 03:00:15 2021 -0700 Merge pull request #131 from AtlasMediaGroup/FS-273 Moves /rainbowtrail to the shop (FS-273) commit a4adfa9beea2d6204465209e71029500c6467052 Merge: 1b5bbd1c a42cb6af Author: Video Date: Mon Nov 29 02:46:41 2021 -0700 Merge branch 'development' into FS-273 commit 225ade87533d11daeef38231fcd6a4cb5bda36ec Merge: afe755f5 a42cb6af Author: Video Date: Mon Nov 29 02:46:02 2021 -0700 Merge branch 'development' into FS-7 commit a42cb6aff98f97469202f686f67c010fffe8bc2c Merge: 2ecfb886 01fdf766 Author: Video Date: Mon Nov 29 02:41:34 2021 -0700 Merge pull request #125 from AtlasMediaGroup/shitcan-savedflags Shitcans SavedFlags commit 01fdf766ee831bd4f9ae1b887b75b559e1171bd7 Merge: 58c21bb1 2ecfb886 Author: Video Date: Tue Nov 23 09:28:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit afe755f5c1406804f10ed221fd9365f736168610 Merge: 5f97e68e 2ecfb886 Author: Video Date: Tue Nov 23 09:26:59 2021 -0700 Merge branch 'development' into FS-7 commit 5f97e68e0eb02a2037c9239d9a466d0124efd4ac Author: Video Date: Tue Nov 23 09:26:49 2021 -0700 fuck it, it works commit 1b5bbd1c05b38a3af14a51842f96b54ab141710d Merge: 8356e831 2ecfb886 Author: Video Date: Tue Nov 23 09:16:21 2021 -0700 Merge branch 'development' into FS-273 commit 2ecfb88604dcea061b1fb142f18ca2becec8cfef Merge: 42143c11 bb2ddf11 Author: Video Date: Tue Nov 23 09:15:16 2021 -0700 Merge pull request #130 from AtlasMediaGroup/FS-215 Makes [Discord] a hyperlink (FS-215) commit 8356e831a5188b9bdae36e3672cd3d96919111c0 Author: Video Date: Tue Nov 23 09:11:16 2021 -0700 Redundancy fix and better protection system commit ab00cb840fbb3b0aa92f7ab952776b5d6793ab6a Merge: ecce62f6 42143c11 Author: Video Date: Tue Nov 23 03:31:45 2021 -0700 Merge branch 'development' into FS-273 commit bb2ddf11292cb0945d7be2c5cd012cd96aee40ff Merge: cf9fdc6f 42143c11 Author: Video Date: Tue Nov 23 03:31:19 2021 -0700 Merge branch 'development' into FS-215 commit 58c21bb1aab8b80829663343a9677cfd79d09e19 Merge: fdba119d 42143c11 Author: Video Date: Tue Nov 23 03:30:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit ecce62f6b4dc3641d7a66a37b226305d44c938d0 Merge: d8148530 a598c933 Author: Video Date: Sat Oct 9 00:01:22 2021 -0600 Merge branch 'development' into FS-273 commit cf9fdc6fe4fc278c5cc46745f535bdb7dfce185b Merge: 387ea6f7 a598c933 Author: Video Date: Fri Oct 8 01:43:33 2021 -0600 Merge branch 'development' into FS-215 commit 387ea6f71e36dddcd376ac0f6a555e30a9735067 Merge: a1ecf881 180cd811 Author: Video Date: Fri Oct 1 00:35:12 2021 -0600 Merge branch 'development' into FS-215 commit d81485303659656a1f1c215d3b505b6a7e63925f Merge: 47e63869 213a4338 Author: Ryan Date: Sun Sep 12 13:49:05 2021 +0100 Merge branch 'development' into FS-273 commit a1ecf881094de1da26b181370d08bddb425b4e98 Merge: bd647afe 213a4338 Author: Ryan Date: Sun Sep 12 13:48:59 2021 +0100 Merge branch 'development' into FS-215 commit 5a6a5ff75de1662aeccddbe25d62c44dc748a565 Merge: 6ca61d9c 213a4338 Author: Ryan Date: Sun Sep 12 13:48:50 2021 +0100 Merge branch 'development' into FS-7 commit fdba119d5d7b016a9fddaa05568776f43d02d442 Merge: 61857dd0 213a4338 Author: Ryan Date: Sun Sep 12 13:48:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 61857dd06f05f1ba7242f308de671ea65f33ca80 Merge: 2d18d461 0e12f5e7 Author: Video Date: Sun Sep 12 03:01:37 2021 -0600 Merge branch 'development' into shitcan-savedflags commit bd647afe92d21e9dff65ae9c4c07323f56bfd1cd Merge: 69f17ef2 0e12f5e7 Author: Video Date: Sun Sep 12 02:50:39 2021 -0600 Merge branch 'development' into FS-215 commit 69f17ef2d742cfc77bc659c21fa0ef3007ab2337 Merge: ee1b27fa aebe1ace Author: Video Date: Sun Sep 12 02:01:56 2021 -0600 Merge branch 'development' into FS-215 commit ee1b27fa0df9ee1b579ce4ea6e0f768bb1ac7ca4 Merge: 2bdf14f3 0a9b95bf Author: Ryan Date: Sat Sep 11 01:24:00 2021 +0100 Merge branch 'development' into FS-215 commit 6ca61d9c6c506f7532290bb6e2d5a5f484f0e36c Merge: fedf80b8 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:52 2021 +0100 Merge branch 'development' into FS-7 commit 2d18d461fea83aef743967e10f8c6d6afd67a09c Merge: a4c81f20 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 47e638690731402f3f859168ad3eb601608b38bf Merge: b1062fbb 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:13 2021 +0100 Merge branch 'development' into FS-273 commit fedf80b834dc02d4a2ea5676224643906b661235 Merge: a2d11d4b 44ff621d Author: Video Date: Fri Sep 10 01:39:16 2021 -0600 Merge branch 'development' into FS-7 commit 2bdf14f38c07c70e392879e2c18be02e0c847af2 Merge: f6d46b61 44ff621d Author: Video Date: Mon Sep 6 15:26:13 2021 -0600 Merge branch 'development' into FS-215 commit b1062fbb6c8587317cc5c107da0357873559e0a3 Merge: f69feed4 44ff621d Author: Video Date: Mon Sep 6 14:39:32 2021 -0600 Merge branch 'development' into FS-273 commit f69feed469da5cb1852e96b68b742f261a3652ff Author: Video Date: Mon Sep 6 01:14:21 2021 -0600 fixed commit 8253f94ac4d71e068d687c87c76bdba13a9b6553 Merge: daf0126f 54cb0cfa Author: Video Date: Mon Sep 6 01:12:00 2021 -0600 Merge branch 'development' into FS-273 commit a4c81f202cd041d4f084135bbd9b0a1d77cd6505 Merge: 0d09c3a5 23caa4e8 Author: Ryan Date: Sat Sep 4 01:23:06 2021 +0100 Merge branch 'development' into shitcan-savedflags commit daf0126f4560c9c75f68e3e302f4fb2b41bd7dd3 Merge: a51f5c9b 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:39 2021 +0100 Merge branch 'development' into FS-273 commit f6d46b6178a9c135df11b5305ba6fb16404381c5 Merge: ee804d52 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:33 2021 +0100 Merge branch 'development' into FS-215 commit a2d11d4b939b524bfebef20dd79ac0476e80de91 Merge: dc490659 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:28 2021 +0100 Merge branch 'development' into FS-7 commit a51f5c9bbfae2665b229e6ffff267ddbe9a956d4 Author: Video Date: Fri Sep 3 13:53:33 2021 -0600 FS-273 commit ee804d52ff0747fdf67398b12080f708460b402c Author: Video Date: Fri Sep 3 12:52:15 2021 -0600 Makes [Discord] a hyperlink (FS-215) I've decided to overhaul the implementation of DiscordToMinecraftListener to make it more easily workable. This overhaul allows me to implement FS-215 more easily. commit dc490659c11f728c99584e591f79ddd61d11b4e8 Author: Video Date: Fri Sep 3 00:07:20 2021 -0600 Begins implementing FS-7 should be good enough, but feedback would be lovely commit 0d09c3a550eb014793cc800021a0064aaad5e3b1 Merge: e2ccd14e 4c3f188b Author: Ryan Date: Sun Aug 29 20:09:03 2021 +0100 Merge branch 'development' into shitcan-savedflags commit e2ccd14eb383844c1bfb5d0e56e7924bb47f5997 Author: Video Date: Fri Aug 27 16:54:55 2021 -0600 Unsaves SavedFlags --- .../command/Command_coins.java | 126 +++++++++++++++--- .../command/Command_opall.java | 4 + 2 files changed, 111 insertions(+), 19 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java index f50b8985..3d0a812d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java @@ -9,8 +9,11 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; + @CommandPermissions(level = Rank.OP, source = SourceType.BOTH) -@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/ [playername]") +@CommandParameters(description = "Shows the amount of coins you or another player has. Also allows you to give coins to other players.", usage = "/ [player] | pay ") public class Command_coins extends FreedomCommand { @Override @@ -21,34 +24,119 @@ public class Command_coins extends FreedomCommand msg("The shop is currently disabled!", ChatColor.RED); return true; } - Player p; + 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]); - } - else - { - msg(PLAYER_NOT_FOUND); + if (senderIsConsole) + { + msg("When used from the console, you must define a target player."); + } + else + { + PlayerData playerData = getData(playerSender); + msg(prefix + ChatColor.GREEN + "You have " + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN + + " coins."); + } return true; } - } - else - { - if (senderIsConsole) + + // Mode for seeing how many coins a player has. + case 1: { - msg(prefix + ChatColor.RED + "You are not a player, use /coins "); + 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; } - 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 getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) + { + if (args.length == 1) + { + List options = new ArrayList<>(FUtil.getPlayerList()); + + options.add("pay"); + + return options; + } + + return FUtil.getPlayerList(); } } \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java index a02671cc..45ff1689 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java @@ -24,6 +24,10 @@ public class Command_opall extends FreedomCommand msg(player, YOU_ARE_OP); plugin.rm.updateDisplay(player); } + else + { + player.recalculatePermissions(); + } } return true; From af6411b82c47502e59db1f491f914ecf0c1ee1a6 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 06:54:04 -0700 Subject: [PATCH 06/10] Wait a second This *should* work... --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7d7c4aa8..d250bef5 100644 --- a/pom.xml +++ b/pom.xml @@ -282,9 +282,9 @@ 3.8.1 TotalFreedomMod.jar - 17 - 17 - 17 + 11 + 11 + 11 From 6e7ad731526989596d71f5dd038bed1d881ab037 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 07:03:29 -0700 Subject: [PATCH 07/10] Nevermind that didn't work --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d250bef5..7d7c4aa8 100644 --- a/pom.xml +++ b/pom.xml @@ -282,9 +282,9 @@ 3.8.1 TotalFreedomMod.jar - 11 - 11 - 11 + 17 + 17 + 17 From cf5199f28eab399a9a081f2980d3f821f8d5bdeb Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 21 Feb 2022 16:45:03 -0700 Subject: [PATCH 08/10] Squashed commit of the following: commit 43c68579e54e6029f8e82ffa354f9ca2ff4c4e63 Merge: 2618d97a b711ed51 Author: elmon Date: Mon Feb 21 10:01:39 2022 +0100 Merge pull request #190 from AtlasMediaGroup/Elmon11-patch-2 order of messages fix commit b711ed517f25156e24e2229262d36ed0bb014ed8 Merge: 1c464729 2618d97a Author: elmon Date: Mon Jan 24 22:16:24 2022 +0100 Merge branch 'development' into Elmon11-patch-2 commit 2618d97a3ecc9a066ef44bfd9ed298ed11a0505f Author: Nathan Curran <30569566+Focusvity@users.noreply.github.com> Date: Mon Jan 24 12:42:47 2022 +1100 Remove requireNonNull method from getIp, which causes NPE - resolves FS-429 (#187) Co-authored-by: Paldiu commit 1c4647290a9101516f0d5501694359bf3ed00183 Merge: f00f67a8 850f1210 Author: Nathan Curran <30569566+Focusvity@users.noreply.github.com> Date: Mon Jan 24 12:41:47 2022 +1100 Merge branch 'development' into Elmon11-patch-2 commit f00f67a844156836041b53b48cdad527b63f887a Author: elmon Date: Sun Jan 23 13:26:22 2022 +0100 order of messages fix https://media.discordapp.net/attachments/874713176082636882/934559012991680532/unknown.png commit 850f12103c701fbd3f8034d924ebc3ce5d6cb5f4 Merge: 2eb0ab4c 7fd77f3c Author: Paldiu Date: Mon Jan 17 11:35:09 2022 -0600 Merge pull request #188 from AtlasMediaGroup/Wild1145-patch-1 Correct CoreProtect Version commit 7fd77f3cbb7bd8bfb9286f42f113fd9ea1ef99a8 Author: Ryan Date: Sun Jan 16 18:22:16 2022 +0000 Correct CoreProtect Version To align with the version running on Freedom-01 at the moment. commit 2eb0ab4cb1d5ebcea0b5e26870b2a36327a87b3a Merge: 8cff0124 2612aaec Author: Video Date: Wed Dec 22 20:56:46 2021 -0700 Merge pull request #179 from AtlasMediaGroup/FS-212 Makes spawnmob configurable, increases the default limit to 25 (FS-212) commit 2612aaec31d6b372fec85b86d608ce2b74bb9463 Author: Video Date: Wed Dec 15 21:46:56 2021 -0700 Makes spawnmob configurable and increases the default limit to 25 commit 8cff0124eaf4da1ae7bb3377845302e54c8ac73e Merge: 35965b0b 1162f10e Author: Video Date: Mon Nov 29 06:36:20 2021 -0700 Merge pull request #93 from AtlasMediaGroup/FS-37 Fixes FS-37 commit 1162f10ebb1c3b3428c315354bbdd9c670d125fe Merge: 7ce173e0 35965b0b Author: Video Date: Mon Nov 29 06:31:18 2021 -0700 Merge branch 'development' into FS-37 commit 35965b0b1076273e8a16247694802cb427622e1d Merge: aa20a6e5 1253732f Author: Video Date: Mon Nov 29 06:31:11 2021 -0700 Merge pull request #174 from AtlasMediaGroup/FS-256 Forces the server to recalculate the permissions server-wide in /opall (FS-256) commit 1253732f7740ff5ad656d4f9d7e0354a7466f69e Merge: e1bee321 aa20a6e5 Author: Video Date: Mon Nov 29 06:25:25 2021 -0700 Merge branch 'development' into FS-256 commit 7ce173e02b28a76f3d900c75bb18166714a28cc7 Merge: 4d006ed1 aa20a6e5 Author: Video Date: Mon Nov 29 06:24:34 2021 -0700 Merge branch 'development' into FS-37 commit aa20a6e579cb1cc147d231d65891b911fbf25a08 Merge: 70622900 1ecfb0b0 Author: Video Date: Mon Nov 29 06:23:57 2021 -0700 Merge pull request #129 from AtlasMediaGroup/FS-7 Allow players to pay other players coins [FS-7] commit e1bee32163aa015d6d61b9d6a019a261c6602731 Author: Video Date: Mon Nov 29 03:27:07 2021 -0700 Forces the server to recalculate the permissions server-wide in /opall commit 4d006ed172a31b05730930a26275280d1de04e01 Merge: 8cbfde8b 70622900 Author: Video Date: Mon Nov 29 03:04:42 2021 -0700 Merge branch 'development' into FS-37 commit 1ecfb0b0660d88c3f8223dc80cd127891fa51dbf Merge: 225ade87 70622900 Author: Video Date: Mon Nov 29 03:01:22 2021 -0700 Merge branch 'development' into FS-7 commit 706229004c50c26b4cd2bf4fcbe5a7a889cf7b63 Merge: a42cb6af a4adfa9b Author: Video Date: Mon Nov 29 03:00:15 2021 -0700 Merge pull request #131 from AtlasMediaGroup/FS-273 Moves /rainbowtrail to the shop (FS-273) commit a4adfa9beea2d6204465209e71029500c6467052 Merge: 1b5bbd1c a42cb6af Author: Video Date: Mon Nov 29 02:46:41 2021 -0700 Merge branch 'development' into FS-273 commit 225ade87533d11daeef38231fcd6a4cb5bda36ec Merge: afe755f5 a42cb6af Author: Video Date: Mon Nov 29 02:46:02 2021 -0700 Merge branch 'development' into FS-7 commit 8cbfde8bbc9e321b856a4cc72c0d827af1b09627 Merge: bba5ec92 a42cb6af Author: Video Date: Mon Nov 29 02:41:49 2021 -0700 Merge branch 'development' into FS-37 commit a42cb6aff98f97469202f686f67c010fffe8bc2c Merge: 2ecfb886 01fdf766 Author: Video Date: Mon Nov 29 02:41:34 2021 -0700 Merge pull request #125 from AtlasMediaGroup/shitcan-savedflags Shitcans SavedFlags commit 01fdf766ee831bd4f9ae1b887b75b559e1171bd7 Merge: 58c21bb1 2ecfb886 Author: Video Date: Tue Nov 23 09:28:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit afe755f5c1406804f10ed221fd9365f736168610 Merge: 5f97e68e 2ecfb886 Author: Video Date: Tue Nov 23 09:26:59 2021 -0700 Merge branch 'development' into FS-7 commit 5f97e68e0eb02a2037c9239d9a466d0124efd4ac Author: Video Date: Tue Nov 23 09:26:49 2021 -0700 fuck it, it works commit 1b5bbd1c05b38a3af14a51842f96b54ab141710d Merge: 8356e831 2ecfb886 Author: Video Date: Tue Nov 23 09:16:21 2021 -0700 Merge branch 'development' into FS-273 commit 2ecfb88604dcea061b1fb142f18ca2becec8cfef Merge: 42143c11 bb2ddf11 Author: Video Date: Tue Nov 23 09:15:16 2021 -0700 Merge pull request #130 from AtlasMediaGroup/FS-215 Makes [Discord] a hyperlink (FS-215) commit 8356e831a5188b9bdae36e3672cd3d96919111c0 Author: Video Date: Tue Nov 23 09:11:16 2021 -0700 Redundancy fix and better protection system commit ab00cb840fbb3b0aa92f7ab952776b5d6793ab6a Merge: ecce62f6 42143c11 Author: Video Date: Tue Nov 23 03:31:45 2021 -0700 Merge branch 'development' into FS-273 commit bb2ddf11292cb0945d7be2c5cd012cd96aee40ff Merge: cf9fdc6f 42143c11 Author: Video Date: Tue Nov 23 03:31:19 2021 -0700 Merge branch 'development' into FS-215 commit bba5ec922b8eab37eeb8c356145cf265f717dbdf Merge: 68adaed9 42143c11 Author: Video Date: Tue Nov 23 03:31:13 2021 -0700 Merge branch 'development' into FS-37 commit 58c21bb1aab8b80829663343a9677cfd79d09e19 Merge: fdba119d 42143c11 Author: Video Date: Tue Nov 23 03:30:48 2021 -0700 Merge branch 'development' into shitcan-savedflags commit 68adaed9977f8277796350859acdb221da4290aa Merge: 087b8dd7 a598c933 Author: Video Date: Sat Oct 9 00:09:24 2021 -0600 Merge branch 'development' into FS-37 commit ecce62f6b4dc3641d7a66a37b226305d44c938d0 Merge: d8148530 a598c933 Author: Video Date: Sat Oct 9 00:01:22 2021 -0600 Merge branch 'development' into FS-273 commit cf9fdc6fe4fc278c5cc46745f535bdb7dfce185b Merge: 387ea6f7 a598c933 Author: Video Date: Fri Oct 8 01:43:33 2021 -0600 Merge branch 'development' into FS-215 commit 387ea6f71e36dddcd376ac0f6a555e30a9735067 Merge: a1ecf881 180cd811 Author: Video Date: Fri Oct 1 00:35:12 2021 -0600 Merge branch 'development' into FS-215 commit d81485303659656a1f1c215d3b505b6a7e63925f Merge: 47e63869 213a4338 Author: Ryan Date: Sun Sep 12 13:49:05 2021 +0100 Merge branch 'development' into FS-273 commit a1ecf881094de1da26b181370d08bddb425b4e98 Merge: bd647afe 213a4338 Author: Ryan Date: Sun Sep 12 13:48:59 2021 +0100 Merge branch 'development' into FS-215 commit 5a6a5ff75de1662aeccddbe25d62c44dc748a565 Merge: 6ca61d9c 213a4338 Author: Ryan Date: Sun Sep 12 13:48:50 2021 +0100 Merge branch 'development' into FS-7 commit fdba119d5d7b016a9fddaa05568776f43d02d442 Merge: 61857dd0 213a4338 Author: Ryan Date: Sun Sep 12 13:48:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 087b8dd7eaddfb0f33a1288e0f5442eb3a45b392 Merge: 3818aab4 213a4338 Author: Ryan Date: Sun Sep 12 13:48:21 2021 +0100 Merge branch 'development' into FS-37 commit 3818aab454dcd72c0c64f3c6e4710fb3e0f94643 Merge: caeda219 0e12f5e7 Author: Video Date: Sun Sep 12 03:04:08 2021 -0600 Merge branch 'development' into FS-37 commit 61857dd06f05f1ba7242f308de671ea65f33ca80 Merge: 2d18d461 0e12f5e7 Author: Video Date: Sun Sep 12 03:01:37 2021 -0600 Merge branch 'development' into shitcan-savedflags commit bd647afe92d21e9dff65ae9c4c07323f56bfd1cd Merge: 69f17ef2 0e12f5e7 Author: Video Date: Sun Sep 12 02:50:39 2021 -0600 Merge branch 'development' into FS-215 commit 69f17ef2d742cfc77bc659c21fa0ef3007ab2337 Merge: ee1b27fa aebe1ace Author: Video Date: Sun Sep 12 02:01:56 2021 -0600 Merge branch 'development' into FS-215 commit caeda219fa38e646111d73d0be08c34d52e6d973 Merge: 3ca98352 0a9b95bf Author: Ryan Date: Sat Sep 11 15:26:37 2021 +0100 Merge branch 'development' into FS-37 commit ee1b27fa0df9ee1b579ce4ea6e0f768bb1ac7ca4 Merge: 2bdf14f3 0a9b95bf Author: Ryan Date: Sat Sep 11 01:24:00 2021 +0100 Merge branch 'development' into FS-215 commit 6ca61d9c6c506f7532290bb6e2d5a5f484f0e36c Merge: fedf80b8 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:52 2021 +0100 Merge branch 'development' into FS-7 commit 2d18d461fea83aef743967e10f8c6d6afd67a09c Merge: a4c81f20 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:44 2021 +0100 Merge branch 'development' into shitcan-savedflags commit 47e638690731402f3f859168ad3eb601608b38bf Merge: b1062fbb 0a9b95bf Author: Ryan Date: Sat Sep 11 01:23:13 2021 +0100 Merge branch 'development' into FS-273 commit fedf80b834dc02d4a2ea5676224643906b661235 Merge: a2d11d4b 44ff621d Author: Video Date: Fri Sep 10 01:39:16 2021 -0600 Merge branch 'development' into FS-7 commit 2bdf14f38c07c70e392879e2c18be02e0c847af2 Merge: f6d46b61 44ff621d Author: Video Date: Mon Sep 6 15:26:13 2021 -0600 Merge branch 'development' into FS-215 commit b1062fbb6c8587317cc5c107da0357873559e0a3 Merge: f69feed4 44ff621d Author: Video Date: Mon Sep 6 14:39:32 2021 -0600 Merge branch 'development' into FS-273 commit 3ca98352570943ebfec3801d0d95e7b7d7b51446 Merge: da82b270 54cb0cfa Author: Video Date: Mon Sep 6 01:16:04 2021 -0600 Merge branch 'development' into FS-37 commit f69feed469da5cb1852e96b68b742f261a3652ff Author: Video Date: Mon Sep 6 01:14:21 2021 -0600 fixed commit 8253f94ac4d71e068d687c87c76bdba13a9b6553 Merge: daf0126f 54cb0cfa Author: Video Date: Mon Sep 6 01:12:00 2021 -0600 Merge branch 'development' into FS-273 commit a4c81f202cd041d4f084135bbd9b0a1d77cd6505 Merge: 0d09c3a5 23caa4e8 Author: Ryan Date: Sat Sep 4 01:23:06 2021 +0100 Merge branch 'development' into shitcan-savedflags commit da82b2701633359b9129f9bcd4944b7a2bbb7d83 Merge: af1df228 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:55 2021 +0100 Merge branch 'development' into FS-37 commit daf0126f4560c9c75f68e3e302f4fb2b41bd7dd3 Merge: a51f5c9b 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:39 2021 +0100 Merge branch 'development' into FS-273 commit f6d46b6178a9c135df11b5305ba6fb16404381c5 Merge: ee804d52 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:33 2021 +0100 Merge branch 'development' into FS-215 commit a2d11d4b939b524bfebef20dd79ac0476e80de91 Merge: dc490659 23caa4e8 Author: Ryan Date: Sat Sep 4 01:07:28 2021 +0100 Merge branch 'development' into FS-7 commit a51f5c9bbfae2665b229e6ffff267ddbe9a956d4 Author: Video Date: Fri Sep 3 13:53:33 2021 -0600 FS-273 commit ee804d52ff0747fdf67398b12080f708460b402c Author: Video Date: Fri Sep 3 12:52:15 2021 -0600 Makes [Discord] a hyperlink (FS-215) I've decided to overhaul the implementation of DiscordToMinecraftListener to make it more easily workable. This overhaul allows me to implement FS-215 more easily. commit dc490659c11f728c99584e591f79ddd61d11b4e8 Author: Video Date: Fri Sep 3 00:07:20 2021 -0600 Begins implementing FS-7 should be good enough, but feedback would be lovely commit 0d09c3a550eb014793cc800021a0064aaad5e3b1 Merge: e2ccd14e 4c3f188b Author: Ryan Date: Sun Aug 29 20:09:03 2021 +0100 Merge branch 'development' into shitcan-savedflags commit e2ccd14eb383844c1bfb5d0e56e7924bb47f5997 Author: Video Date: Fri Aug 27 16:54:55 2021 -0600 Unsaves SavedFlags commit af1df22812661191801d95d024c3607c1fa14115 Merge: 1474a808 f380898b Author: Video Date: Thu Aug 26 23:05:58 2021 -0600 Merge branch 'development' into FS-37 commit 1474a808750215bf40481f6227c8eb5c6dc7d437 Merge: 77fd4ff6 f45466ee Author: Ryan Date: Thu Aug 26 13:26:44 2021 +0100 Merge branch 'development' into FS-37 commit 77fd4ff66ae09c535b857bfa53997b96487e3f9a Merge: 33aca2a4 d901cbaa Author: Ryan Date: Sat Aug 21 21:34:04 2021 +0100 Merge branch 'development' into FS-37 commit 33aca2a482c013debe9bab5467981ebdafdc1d4e Merge: 159eda73 0582c2e5 Author: Video Date: Tue Aug 10 22:38:51 2021 -0600 Merge branch 'development' into FS-37 commit 159eda73a1389f1e33a4e6bb948de50a6c09423f Merge: da2d2525 6874b2ce Author: Ryan Date: Tue Aug 10 17:34:12 2021 +0100 Merge branch 'development' into FS-37 commit da2d25252b996605434f29fa7660de6e772e3c80 Merge: e99aaa2e c8a4382a Author: Ryan Date: Tue Aug 10 17:31:13 2021 +0100 Merge branch 'development' into FS-37 commit e99aaa2eb4665aac0686d029774d604dc3118279 Author: Video Date: Thu Aug 5 00:32:23 2021 -0600 Fixes FS-37 Fixes an oversight introduced in https://github.com/AtlasMediaGroup/TotalFreedomMod/commit/76bb2d08acb9a56a845377e2106a8f7e2d8a0750 in which the configuration is loaded twice. --- .../totalfreedommod/TotalFreedomMod.java | 1 - .../totalfreedommod/command/Command_mute.java | 18 ++++++++++-------- .../command/Command_spawnmob.java | 7 +++++-- .../totalfreedommod/config/ConfigEntry.java | 2 ++ .../totalfreedommod/util/FUtil.java | 2 +- src/main/resources/config.yml | 4 ++++ 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 1bb8207b..e5593b91 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -186,7 +186,6 @@ public class TotalFreedomMod extends JavaPlugin fsh = new FreedomServiceHandler(); config = new MainConfig(); - config.load(); if (FUtil.inDeveloperMode()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java index 0ce530d4..e66c0c73 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java @@ -130,17 +130,19 @@ public class Command_mute extends FreedomCommand { playerdata.setMuted(true); 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) { 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) { @@ -178,4 +180,4 @@ public class Command_mute extends FreedomCommand return Collections.emptyList(); } -} \ No newline at end of file +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java index 5306ceda..2ef26e69 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod.command; import java.util.List; + +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.EnumUtils; @@ -55,6 +57,7 @@ public class Command_spawnmob extends FreedomCommand return true; } + int max = ConfigEntry.SPAWNMOB_MAX.getInteger(); int amount = 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; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 86fb22a3..4d336882 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -45,6 +45,8 @@ public enum ConfigEntry MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"), MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"), // + SPAWNMOB_MAX(Integer.class, "spawnmob.max"), + // HTTPD_ENABLED(Boolean.class, "httpd.enabled"), HTTPD_HOST(String.class, "httpd.host"), HTTPD_PORT(Integer.class, "httpd.port"), diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index ea7a7344..f6988aec 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -752,7 +752,7 @@ public class FUtil 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) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b8dbaaf2..33b4b43e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -509,6 +509,10 @@ moblimiter: slime: true giant: true +# Spawnmob +spawnmob: + max: 25 + # Flatlands flatlands: generate: true From 004a0f3d7c30c443baacd11d160c9c9d6c68ac19 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 21 Feb 2022 17:04:53 -0700 Subject: [PATCH 09/10] Update Groups.java This should resolve the issues with spawn eggs and mobs. --- .../totalfreedommod/util/Groups.java | 135 +----------------- 1 file changed, 2 insertions(+), 133 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java b/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java index b0f66ded..0df27d99 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java @@ -45,140 +45,9 @@ public class Groups Material.LIGHT_GRAY_SHULKER_BOX, Material.BLACK_SHULKER_BOX); - public static final List MOB_TYPES = Arrays.asList( - 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 MOB_TYPES = Arrays.stream(EntityType.values()).filter(EntityType::isAlive).filter(EntityType::isSpawnable).toList(); - public static final List SPAWN_EGGS = Arrays.asList( - 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 SPAWN_EGGS = Arrays.stream(Material.values()).filter((mat) -> mat.name().endsWith("_SPAWN_EGG")).toList(); public static final List BANNERS = Arrays.asList( Material.BLACK_BANNER, From 82e966dfb03f72632e163a94ab03b7cb01a30407 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 22 Feb 2022 20:50:41 +0000 Subject: [PATCH 10/10] Delete java11-maven.yml --- .github/workflows/java11-maven.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/java11-maven.yml diff --git a/.github/workflows/java11-maven.yml b/.github/workflows/java11-maven.yml deleted file mode 100644 index 967abde2..00000000 --- a/.github/workflows/java11-maven.yml +++ /dev/null @@ -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