From a29392cab247dfcd23ed93477c41eb5facc2505e Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 29 Nov 2021 03:03:00 -0700 Subject: [PATCH] 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: