Login messages for players. Still need to come up with login messaghes

This commit is contained in:
Seth 2020-10-02 02:27:06 -07:00
parent f8304aecd7
commit 533e4fe369
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
16 changed files with 228 additions and 134 deletions

View File

@ -0,0 +1,52 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.shop.ShopItem;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Change your login message", usage = "/<command> [message]")
public class Command_loginmessage extends FreedomCommand
{
@Override
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.LOGIN_MESSAGES) && !isStaff(playerSender))
{
msg("You did not purchase the ability to use login messages! Purchase the ability from the shop.", ChatColor.RED);
return true;
}
if (args.length == 0)
{
playerSender.openInventory(plugin.sh.generateLoginMessageGUI(playerSender));
return true;
}
checkRank(Rank.ADMIN);
String message = StringUtils.join(args, " ");
if (!message.contains("%rank%") && !message.contains("%coloredrank%"))
{
msg("Your login message must contain your rank. Use either %rank% or %coloredrank% to specify where you want the rank", ChatColor.RED);
return true;
}
int length = message.replace("%name%", "").replace("%rank%", "").replace("%coloredrank%", "").replace("%det%", "").length();
if (length > 100)
{
msg("Your login message cannot be more than 100 characters (excluding your rank and your name)", ChatColor.RED);
return true;
}
PlayerData data = getData(playerSender);
data.setLoginMessage(message);
plugin.pl.save(data);
msg("Your login message is now the following:\n" + plugin.rm.craftLoginMessage(playerSender, message), ChatColor.GREEN);
return true;
}
}

View File

@ -17,7 +17,7 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your staff entry.", usage = "/<command> [-o <staff member>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setscformat <format> | clearscformat> | oldtags | logstick | syncroles>")
public class Command_mystaff extends FreedomCommand
public class Command_myadmin extends FreedomCommand
{
@Override
@ -139,46 +139,6 @@ public class Command_mystaff extends FreedomCommand
return true;
}
case "setlogin":
{
checkRank(Rank.ADMIN);
if (args.length < 2)
{
return false;
}
String message = StringUtils.join(args, " ", 1, args.length);
if (!message.contains("%rank%") && !message.contains("%coloredrank%"))
{
msg("Your login message must contain your rank. Use either %rank% or %coloredrank% to specify where you want the rank", ChatColor.RED);
return true;
}
int length = message.replace("%name%", "").replace("%rank%", "").replace("%coloredrank%", "").length();
if (length > 100)
{
msg("Your login message cannot be more than 100 characters (excluding your rank and your name)", ChatColor.RED);
return true;
}
FUtil.staffAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
target.setLoginMessage(message);
String previewMessage = plugin.rm.craftLoginMessage(targetPlayer, message);
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
msg("> " + previewMessage);
plugin.sl.save(target);
plugin.sl.updateTables();
return true;
}
case "clearlogin":
{
checkRank(Rank.ADMIN);
FUtil.staffAction(sender.getName(), "Clearing personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
target.setLoginMessage(null);
plugin.sl.save(target);
plugin.sl.updateTables();
return true;
}
case "setscformat":
{
String format = StringUtils.join(args, " ", 1, args.length);
@ -229,10 +189,6 @@ public class Command_mystaff extends FreedomCommand
return true;
}
case "genbackupcodes":
msg("Moved to /pv genbackupcodes", ChatColor.RED);
return true;
default:
{
return false;
@ -248,8 +204,8 @@ public class Command_mystaff extends FreedomCommand
return Collections.emptyList();
}
List<String> singleArguments = Arrays.asList("clearips", "setlogin", "setscformat");
List<String> doubleArguments = Arrays.asList("clearip", "clearlogin", "clearscformat", "oldtags", "syncroles");
List<String> singleArguments = Arrays.asList("clearips", "setscformat");
List<String> doubleArguments = Arrays.asList("clearip", "clearscformat", "syncroles");
if (args.length == 1)
{
List<String> options = new ArrayList<>();

View File

@ -99,11 +99,6 @@ public enum ConfigEntry
PTERO_ADMIN_KEY(String.class, "ptero.admin_key"),
PTERO_SERVER_KEY(String.class, "ptero.server_key"),
//
DONATION_PROBOARDS_URL(String.class, "donation.proboards_url"),
DONATION_GROUP_ID(String.class, "donation.donator_group_id"),
DONATION_SESSION_ID(String.class, "donation.session_id"),
DONATION_CSRF_TOKEN(String.class, "donation.csrf_token"),
//
SHOP_ENABLED(Boolean.class, "shop.enabled"),
SHOP_TITLE(String.class, "shop.title"),
SHOP_PREFIX(String.class, "shop.prefix"),
@ -113,12 +108,14 @@ public enum ConfigEntry
SHOP_REACTIONS_TIME(Double.class, "shop.reactions.time"),
SHOP_REACTIONS_COINS_PER_WIN(Integer.class, "shop.reactions.coins_per_win"),
SHOP_REACTIONS_STRING_LENGTH(Integer.class, "shop.reactions.string_length"),
SHOP_LOGIN_MESSAGES(List.class, "shop.login_messages"),
SHOP_PRICES_GRAPPLING_HOOK(Integer.class, "shop.prices.grappling_hook"),
SHOP_PRICES_LIGHTNING_ROD(Integer.class, "shop.prices.lightning_rod"),
SHOP_PRICES_FIRE_BALL(Integer.class, "shop.prices.fire_ball"),
SHOP_PRICES_RIDEABLE_PEARL(Integer.class, "shop.prices.rideable_pearl"),
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"),
//
STAFFLIST_CLEAN_THESHOLD_HOURS(Integer.class, "stafflist.clean_threshold_hours"),
STAFFLIST_CONSOLE_IS_ADMIN(Boolean.class, "stafflist.console_is_admin"),

View File

@ -73,7 +73,7 @@ public class Module_list extends HTTPDModule
operators.add(player.getName());
}
if (!hasSpecialTitle(player) && plugin.sl.isStaff(player))
if (!hasSpecialTitle(player) && plugin.sl.isStaff(player) && !plugin.sl.isVanished(player.getName()))
{
StaffMember staffMember = plugin.sl.getAdmin(player);
switch (staffMember.getRank())
@ -142,7 +142,7 @@ public class Module_list extends HTTPDModule
public boolean hasSpecialTitle(Player player)
{
if (FUtil.DEVELOPERS.contains(player.getName()) || ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) || ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
if (FUtil.DEVELOPERS.contains(player.getUniqueId().toString()) || ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) || ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
{
return true;
}

View File

@ -64,7 +64,7 @@ public class Module_players extends HTTPDModule
masterbuilders.addAll(plugin.pl.getMasterBuilderNames());
// Developers
developers.addAll(FUtil.DEVELOPERS);
developers.addAll(FUtil.DEVELOPER_NAMES);
// Executives
executives.addAll(ConfigEntry.SERVER_EXECUTIVES.getList());

View File

@ -33,8 +33,6 @@ public class PlayerData
private String discordID = null;
private final List<String> backupCodes = Lists.newArrayList();
@Setter
private boolean donator = false;
@Setter
private Boolean masterBuilder = false;
@Setter
private Boolean verification = false;
@ -53,6 +51,9 @@ public class PlayerData
@Getter
@Setter
private String redditUsername;
@Getter
@Setter
private String loginMessage;
public PlayerData(ResultSet resultSet)
{
@ -67,7 +68,6 @@ public class PlayerData
discordID = resultSet.getString("discord_id");
backupCodes.clear();
backupCodes.addAll(FUtil.stringToList(resultSet.getString("backup_codes")));
donator = resultSet.getBoolean("donator");
masterBuilder = resultSet.getBoolean("master_builder");
verification = resultSet.getBoolean("verification");
rideMode = resultSet.getString("ride_mode");
@ -77,6 +77,7 @@ public class PlayerData
totalVotes = resultSet.getInt("total_votes");
displayDiscord = resultSet.getBoolean("display_discord");
redditUsername = resultSet.getString("reddit_username");
loginMessage = resultSet.getString("login_message");
}
catch (SQLException e)
{
@ -104,7 +105,6 @@ public class PlayerData
output.append("Player: ").append(name).append("\n")
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
.append("- Discord ID: ").append(discordID).append("\n")
.append("- Donator: ").append(donator).append("\n")
.append("- Master Builder: ").append(masterBuilder).append("\n")
.append("- Has Verification: ").append(verification).append("\n")
.append("- Coins: ").append(coins).append("\n")
@ -113,7 +113,8 @@ public class PlayerData
.append("- Tag: ").append(FUtil.colorize(tag)).append(ChatColor.GRAY).append("\n")
.append("- Ride Mode: ").append(rideMode).append("\n")
.append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n")
.append("- Reddit Username: ").append(redditUsername);
.append("- Reddit Username: ").append(redditUsername)
.append("- Login Message: ").append(loginMessage);
return output.toString();
}
@ -128,6 +129,11 @@ public class PlayerData
return Collections.unmodifiableList(ips);
}
public boolean hasLoginMessage()
{
return loginMessage != null && !loginMessage.isEmpty();
}
public boolean addIp(String ip)
{
return !ips.contains(ip) && ips.add(ip);
@ -221,11 +227,6 @@ public class PlayerData
return verification;
}
public boolean isDonator()
{
return donator;
}
public boolean isMasterBuilder()
{
return masterBuilder;
@ -241,7 +242,6 @@ public class PlayerData
put("tag", tag);
put("discord_id", discordID);
put("backup_codes", FUtil.listToString(backupCodes));
put("donator", donator);
put("master_builder", masterBuilder);
put("verification", verification);
put("ride_mode", rideMode);
@ -250,6 +250,7 @@ public class PlayerData
put("total_votes", totalVotes);
put("display_discord", displayDiscord);
put("reddit_username", redditUsername);
put("login_message", loginMessage);
}};
return map;
}

View File

@ -5,6 +5,8 @@ import net.md_5.bungee.api.ChatColor;
public interface Displayable
{
public String getDeterminer();
public String getName();
public String getTag();
@ -21,7 +23,8 @@ public interface Displayable
public String getColoredLoginMessage();
public boolean hasTeam();
public boolean hasDefaultLoginMessage();
}

View File

@ -5,19 +5,20 @@ import net.md_5.bungee.api.ChatColor;
public enum Rank implements Displayable
{
IMPOSTOR("an", "Impostor", Type.PLAYER, "Imp", ChatColor.YELLOW, null, false),
NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.WHITE, null, false),
OP("an", "Operator", Type.PLAYER, "OP", ChatColor.GREEN, null, false),
ADMIN("an", "Admin", Type.STAFF, "Admin", ChatColor.DARK_GREEN, org.bukkit.ChatColor.DARK_GREEN, true),
SENIOR_ADMIN("a", "Senior Admin", Type.STAFF, "SrA", ChatColor.GOLD, org.bukkit.ChatColor.GOLD, true),
ADMIN_CONSOLE("the", "Console", Type.STAFF_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false),
SENIOR_CONSOLE("the", "Console", Type.STAFF_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false);
IMPOSTOR("an", "Impostor", Type.PLAYER, "Imp", ChatColor.YELLOW, null, false, false),
NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.WHITE, null, false, false),
OP("an", "Operator", Type.PLAYER, "OP", ChatColor.GREEN, null, false, false),
ADMIN("an", "Admin", Type.STAFF, "Admin", ChatColor.DARK_GREEN, org.bukkit.ChatColor.DARK_GREEN, true, true),
SENIOR_ADMIN("a", "Senior Admin", Type.STAFF, "SrA", ChatColor.GOLD, org.bukkit.ChatColor.GOLD, true, true),
ADMIN_CONSOLE("the", "Console", Type.STAFF_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false),
SENIOR_CONSOLE("the", "Console", Type.STAFF_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false);
@Getter
private final Type type;
@Getter
private final String name;
@Getter
private final String abbr;
@Getter
private final String determiner;
@Getter
private final String tag;
@ -29,8 +30,10 @@ public enum Rank implements Displayable
private final org.bukkit.ChatColor teamColor;
@Getter
private final boolean hasTeam;
@Getter
private final boolean hasDefaultLoginMessage;
Rank(String determiner, String name, Type type, String abbr, ChatColor color, org.bukkit.ChatColor teamColor, Boolean hasTeam)
Rank(String determiner, String name, Type type, String abbr, ChatColor color, org.bukkit.ChatColor teamColor, Boolean hasTeam, Boolean hasDefaultLoginMessage)
{
this.type = type;
this.name = name;
@ -41,6 +44,7 @@ public enum Rank implements Displayable
this.color = color;
this.teamColor = teamColor;
this.hasTeam = hasTeam;
this.hasDefaultLoginMessage = hasDefaultLoginMessage;
}
@Override
@ -61,6 +65,12 @@ public enum Rank implements Displayable
return hasTeam;
}
@Override
public boolean hasDefaultLoginMessage()
{
return hasDefaultLoginMessage;
}
@Override
public String getAbbr()
{

View File

@ -168,7 +168,7 @@ public class RankManager extends FreedomService
FPlayer fPlayer = plugin.pl.getPlayer(player);
PlayerData data = plugin.pl.getData(player);
Displayable display = getDisplay(player);
if (plugin.sl.isStaff(player) || data.isMasterBuilder() || data.isDonator() || FUtil.isDeveloper(player))
if (plugin.sl.isStaff(player) || data.isMasterBuilder() || FUtil.isDeveloper(player))
{
String displayName = display.getColor() + player.getName();
player.setPlayerListName(displayName);
@ -237,7 +237,7 @@ public class RankManager extends FreedomService
}
// Broadcast login message
if (isStaff || FUtil.isDeveloper(player) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).isDonator())
if (isStaff || FUtil.isDeveloper(player) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).hasLoginMessage())
{
if (!plugin.sl.isVanished(player.getName()))
{
@ -260,25 +260,34 @@ public class RankManager extends FreedomService
public String craftLoginMessage(Player player, String message)
{
Displayable display = plugin.rm.getDisplay(player);
String loginMessage = ChatColor.AQUA + player.getName() + " is " + display.getColoredLoginMessage();
if (plugin.sl.isStaff(player))
{
StaffMember staffMember = plugin.sl.getAdmin(player);
if (staffMember.hasLoginMessage())
{
PlayerData playerData = plugin.pl.getData(player);
if (message == null)
{
message = staffMember.getLoginMessage();
if (playerData.hasLoginMessage())
{
message = playerData.getLoginMessage();
}
loginMessage = FUtil.colorize(ChatColor.AQUA + (message.contains("%name%") ? "" : player.getName() + " is ")
else
{
if (display.hasDefaultLoginMessage())
{
message = "%name% is %det% %coloredrank%";
}
}
}
if (message != null)
{
String loginMessage = FUtil.colorize(ChatColor.AQUA + (message.contains("%name%") ? "" : player.getName() + " is ")
+ FUtil.colorize(message).replace("%name%", player.getName())
.replace("%rank%", display.getName())
.replace("%coloredrank%", display.getColoredName()));
}
}
.replace("%coloredrank%", display.getColoredName())
.replace("%det%", display.getDeterminer()));
return loginMessage;
}
return null;
}
public void updatePlayerTeam(Player player)
{
Displayable display = getDisplay(player);

View File

@ -6,12 +6,13 @@ import net.md_5.bungee.api.ChatColor;
public enum Title implements Displayable
{
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true),
VERIFIED_STAFF("a", "Verified Staff", ChatColor.LIGHT_PURPLE, org.bukkit.ChatColor.LIGHT_PURPLE, "VS", false),
EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true),
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true),
OWNER("the", "Owner", ChatColor.of("#ff0000"), org.bukkit.ChatColor.DARK_RED, "Owner", true);
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true),
VERIFIED_STAFF("a", "Verified Staff Member", ChatColor.LIGHT_PURPLE, org.bukkit.ChatColor.LIGHT_PURPLE, "VS", false, true),
EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true),
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true),
OWNER("the", "Owner", ChatColor.of("#ff0000"), org.bukkit.ChatColor.DARK_RED, "Owner", true, true);
@Getter
private final String determiner;
@Getter
private final String name;
@ -27,8 +28,9 @@ public enum Title implements Displayable
private final org.bukkit.ChatColor teamColor;
@Getter
private final boolean hasTeam;
private final boolean hasDefaultLoginMessage;
Title(String determiner, String name, ChatColor color, org.bukkit.ChatColor teamColor, String tag, Boolean hasTeam)
Title(String determiner, String name, ChatColor color, org.bukkit.ChatColor teamColor, String tag, Boolean hasTeam, Boolean hasDefaultLoginMessage)
{
this.determiner = determiner;
this.name = name;
@ -38,6 +40,7 @@ public enum Title implements Displayable
this.color = color;
this.teamColor = teamColor;
this.hasTeam = hasTeam;
this.hasDefaultLoginMessage = hasDefaultLoginMessage;
}
@Override
@ -52,6 +55,12 @@ public enum Title implements Displayable
return hasTeam;
}
@Override
public boolean hasDefaultLoginMessage()
{
return hasDefaultLoginMessage;
}
@Override
public String getColoredLoginMessage()
{

View File

@ -35,6 +35,7 @@ public class Shop extends FreedomService
public final String prefix = ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "Reaction" + ChatColor.DARK_GRAY + "] ";
public BukkitTask countdownTask;
private BossBar countdownBar = null;
private final String LOGIN_MESSAGE_GUI_TITLE = ChatColor.DARK_GREEN + ChatColor.BOLD.toString() + "Login Messages";
@Override
public void onStart()
@ -174,6 +175,27 @@ public class Shop extends FreedomService
return gui;
}
public Inventory generateLoginMessageGUI(Player player)
{
Inventory gui = server.createInventory(null, 36, LOGIN_MESSAGE_GUI_TITLE);
int slot = 0;
for (String loginMessage : ConfigEntry.SHOP_LOGIN_MESSAGES.getStringList())
{
ItemStack icon = new ItemStack(Material.NAME_TAG);
ItemMeta meta = icon.getItemMeta();
meta.setDisplayName(FUtil.colorize(plugin.rm.craftLoginMessage(player, loginMessage)));
icon.setItemMeta(meta);
gui.setItem(slot, icon);
slot++;
}
ItemStack clear = new ItemStack(Material.BARRIER);
ItemMeta meta = clear.getItemMeta();
meta.setDisplayName(ChatColor.RED + "Clear login message");
clear.setItemMeta(meta);
gui.setItem(35, clear);
return gui;
}
public boolean isRealItem(PlayerData data, ShopItem shopItem, PlayerInventory inventory, ItemStack realItem)
{
if (isRealItem(data, shopItem, inventory.getItemInMainHand(), realItem) || isRealItem(data, shopItem, inventory.getItemInOffHand(), realItem))
@ -306,7 +328,7 @@ public class Shop extends FreedomService
}
@EventHandler(priority = EventPriority.HIGH)
public void onInventoryClick(InventoryClickEvent event)
public void onShopGUIClick(InventoryClickEvent event)
{
if (!(event.getWhoClicked() instanceof Player))
{
@ -350,6 +372,44 @@ public class Shop extends FreedomService
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onLoginMessageGUIClick(InventoryClickEvent event)
{
if (!(event.getWhoClicked() instanceof Player))
{
return;
}
Inventory inventory = event.getInventory();
if (inventory.getSize() != 36 || !event.getView().getTitle().equals(LOGIN_MESSAGE_GUI_TITLE))
{
return;
}
event.setCancelled(true);
int slot = event.getSlot();
Player player = (Player)event.getWhoClicked();
PlayerData data = plugin.pl.getData(player);
if (slot == 35)
{
data.setLoginMessage(null);
plugin.pl.save(data);
player.sendMessage(ChatColor.GREEN + "Removed your login message");
}
else
{
String message = ConfigEntry.SHOP_LOGIN_MESSAGES.getStringList().get(slot);
data.setLoginMessage(message);
plugin.pl.save(data);
player.sendMessage(ChatColor.GREEN + "Your login message is now the following:\n" + plugin.rm.craftLoginMessage(player, message));
}
player.closeInventory();
}
public ShopItem getShopItem(int slot)
{
for (ShopItem shopItem : ShopItem.values())

View File

@ -12,17 +12,18 @@ public enum ShopItem
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, 24, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish");
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");
/*
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, $ = Coins}
Key: g = Grappling Hook, l = Lightning Rod, f = Fire Ball, r = Rideable Ender Pearl, s = Stacking Potato, c = Clown Fish, x = Login Messages $ = Coins}
---------
-g-l-f-r-
--s---c--
--s-c-x--
--------$
*/

View File

@ -82,7 +82,7 @@ public class SQLite extends FreedomService
{
try
{
connection.createStatement().execute("CREATE TABLE `staff` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `ptero_id` VARCHAR);");
connection.createStatement().execute("CREATE TABLE `staff` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `ptero_id` VARCHAR);");
}
catch (SQLException e)
{
@ -93,7 +93,7 @@ public class SQLite extends FreedomService
{
try
{
connection.createStatement().execute("CREATE TABLE `players` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `notes` VARCHAR, `tag` VARCHAR, `discord_id` VARCHAR, `backup_codes` VARCHAR, `donator` BOOLEAN NOT NULL, `master_builder` BOOLEAN NOT NULL,`verification` BOOLEAN NOT NULL, `ride_mode` VARCHAR NOT NULL, `coins` INT NOT NULL, `items` VARCHAR, `total_votes` INT NOT NULL, `display_discord` BOOLEAN NOT NULL, `reddit_username` VARCHAR NOT NULL);");
connection.createStatement().execute("CREATE TABLE `players` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `notes` VARCHAR, `tag` VARCHAR, `discord_id` VARCHAR, `backup_codes` VARCHAR, `donator` BOOLEAN NOT NULL, `master_builder` BOOLEAN NOT NULL,`verification` BOOLEAN NOT NULL, `ride_mode` VARCHAR NOT NULL, `coins` INT NOT NULL, `items` VARCHAR, `total_votes` INT NOT NULL, `display_discord` BOOLEAN NOT NULL, `reddit_username` VARCHAR NOT NULL, `login_message` VARCHAR);");
}
catch (SQLException e)
{
@ -141,7 +141,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to update staff member value: " + e.getMessage());
FLog.severe("Failed to update staff member value:");
FLog.severe(e);
}
}
@ -252,7 +253,6 @@ public class SQLite extends FreedomService
statement.setString(3, staffMember.getRank().toString());
statement.setBoolean(4, staffMember.isActive());
statement.setLong(5, staffMember.getLastLogin().getTime());
statement.setString(6, staffMember.getLoginMessage());
statement.setBoolean(7, staffMember.getCommandSpy());
statement.setBoolean(8, staffMember.getPotionSpy());
statement.setString(9, staffMember.getAcFormat());
@ -261,7 +261,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to add staff member: " + e);
FLog.severe("Failed to add staff member:");
FLog.severe(e);
}
}
@ -269,27 +270,28 @@ public class SQLite extends FreedomService
{
try
{
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, player.getName());
statement.setString(2, FUtil.listToString(player.getIps()));
statement.setString(3, FUtil.listToString(player.getNotes()));
statement.setString(4, player.getTag());
statement.setString(5, player.getDiscordID());
statement.setString(6, FUtil.listToString(player.getBackupCodes()));
statement.setBoolean(7, player.isDonator());
statement.setBoolean(8, player.isMasterBuilder());
statement.setBoolean(9, player.hasVerification());
statement.setString(10, player.getRideMode());
statement.setInt(11, player.getCoins());
statement.setBoolean(7, player.isMasterBuilder());
statement.setBoolean(8, player.hasVerification());
statement.setString(9, player.getRideMode());
statement.setInt(10, player.getCoins());
statement.setString(12, FUtil.listToString(player.getItems()));
statement.setInt(13, player.getTotalVotes());
statement.setBoolean(14, player.doesDisplayDiscord());
statement.setString(15, player.getRedditUsername());
statement.setString(16, player.getLoginMessage());
statement.executeUpdate();
}
catch (SQLException e)
{
FLog.severe("Failed to add player: " + e);
FLog.severe("Failed to add player:");
FLog.severe(e);
}
}
@ -305,7 +307,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to get staff member by name: " + e);
FLog.severe("Failed to get staff member by name:");
FLog.severe(e);
}
return null;
@ -323,7 +326,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to get player by name: " + e);
FLog.severe("Failed to get player by name:");
FLog.severe(e);
}
return null;
@ -337,7 +341,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to get Master Builders: " + e);
FLog.severe("Failed to get Master Builders:");
FLog.severe(e);
}
return null;
@ -355,7 +360,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to get player by ip: " + e.getMessage());
FLog.severe("Failed to get player by ip:");
FLog.severe(e);
}
return null;
@ -369,7 +375,8 @@ public class SQLite extends FreedomService
}
catch (SQLException e)
{
FLog.severe("Failed to remove staff member: " + e.getMessage());
FLog.severe("Failed to remove staff member:");
FLog.severe(e);
}
}

View File

@ -35,9 +35,6 @@ public class StaffMember
private Date lastLogin = new Date();
@Getter
@Setter
private String loginMessage = null;
@Getter
@Setter
private Boolean commandSpy = false;
@Getter
@Setter
@ -65,7 +62,6 @@ public class StaffMember
this.ips.clear();
this.ips.addAll(FUtil.stringToList(resultSet.getString("ips")));
this.lastLogin = new Date(resultSet.getLong("last_login"));
this.loginMessage = resultSet.getString("login_message");
this.commandSpy = resultSet.getBoolean("command_spy");
this.potionSpy = resultSet.getBoolean("potion_spy");
this.acFormat = resultSet.getString("ac_format");
@ -85,7 +81,6 @@ public class StaffMember
output.append("Staff: ").append(name).append("\n")
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
.append("- Last Login: ").append(FUtil.dateToString(lastLogin)).append("\n")
.append("- Custom Login Message: ").append(loginMessage).append("\n")
.append("- Rank: ").append(rank.getName()).append("\n")
.append("- Is Active: ").append(active).append("\n")
.append("- Potion Spy: ").append(potionSpy).append("\n")
@ -104,7 +99,6 @@ public class StaffMember
put("rank", rank.toString());
put("ips", FUtil.listToString(ips));
put("last_login", lastLogin.getTime());
put("login_message", loginMessage);
put("command_spy", commandSpy);
put("potion_spy", potionSpy);
put("ac_format", acFormat);
@ -113,11 +107,6 @@ public class StaffMember
return map;
}
public boolean hasLoginMessage()
{
return loginMessage != null && !loginMessage.isEmpty();
}
// Util IP methods
public void addIp(String ip)
{

View File

@ -56,7 +56,7 @@ 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<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "supernt", "Telesphoreo", "CoolJWB");
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "Telesphoreo", "CoolJWB");
*/
public static final List<String> DEVELOPERS = Arrays.asList(
"1156a81a-23fb-435e-9aff-fe9c2ea7e82d", // Madgeek1450
@ -65,10 +65,10 @@ public class FUtil
"604cbb51-842d-4b43-8b0a-d1d7c6cd2869", // Wild1145
"e67d77c4-fff9-4cea-94cc-9f1f1ab7806b", // aggelosQQ
"0061326b-8b3d-44c8-830a-5f2d59f5dc1b", // scripthead
"53b1512e-3481-4702-9f4f-63cb9c8be6a1", // supernt
"78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo
"67ce0e28-3d6b-469c-ab71-304eec81b614" // CoolJWB
);
public static final List<String> DEVELOPER_NAMES = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "Telesphoreo", "CoolJWB");
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
public static final Map<String, ChatColor> CHAT_COLOR_NAMES = new HashMap<>();
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(

View File

@ -146,6 +146,11 @@ shop:
# How long is the random string (in characters)?
string_length: 10
# Login messages. Use %name% for usernames, and %rank% for ranks/titles
login_messages:
- '&b%name% is a terrible %coloredrank%'
- '&bthat %name% dude is a shitty %coloredrank%'
# Item prices
prices:
grappling_hook: 100
@ -154,6 +159,7 @@ shop:
rideable_pearl: 700
stacking_potato: 300
clown_fish: 1500
login_messages: 5000
# Staff list
stafflist:
@ -190,12 +196,6 @@ social_links:
Website: 'https://totalfreedom.me/'
Discord: 'https://discordapp.com/invite/XXjmAmV/'
donation:
proboards_url: ''
donator_group_id: ''
session_id: ''
csrf_token: ''
# Blocking certain events
allow:
fire_place: false