This commit is contained in:
Video 2021-09-03 13:53:33 -06:00
parent 4c3f188bb8
commit a51f5c9bbf
5 changed files with 41 additions and 17 deletions

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

@ -110,6 +110,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

@ -1,10 +1,9 @@
package me.totalfreedom.totalfreedommod.fun; package me.totalfreedom.totalfreedommod.fun;
import java.util.HashSet; import java.util.*;
import java.util.Objects;
import java.util.Set;
import java.util.SplittableRandom;
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 +17,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 name
@Override @Override
public void onStart() public void onStart()
@ -38,7 +37,12 @@ public class Trailer extends FreedomService
return; return;
} }
if (!trailPlayers.contains(event.getPlayer().getName())) if (!trailPlayers.contains(event.getPlayer().getUniqueId()))
{
return;
}
if (!plugin.pl.getData(event.getPlayer()).hasItem(ShopItem.RAINBOW_TRAIL))
{ {
return; return;
} }
@ -69,7 +73,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 +83,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

@ -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

@ -159,6 +159,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: