mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Changes with chat, add some commands
This commit is contained in:
parent
48ee7b0e6d
commit
4a5032bb4c
@ -10,6 +10,7 @@ import me.totalfreedom.totalfreedommod.util.FLog;
|
|||||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -17,7 +18,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.SoundCategory;
|
import org.bukkit.SoundCategory;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ public class ChatManager extends FreedomService
|
|||||||
event.setMessage(message);
|
event.setMessage(message);
|
||||||
|
|
||||||
// Make format
|
// Make format
|
||||||
String format = "<%1$s> %2$s";
|
String format = "%1$s §8» §f%2$s";
|
||||||
|
|
||||||
String tag = fPlayer.getTag();
|
String tag = fPlayer.getTag();
|
||||||
if (tag != null && !tag.isEmpty())
|
if (tag != null && !tag.isEmpty())
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
|
import net.pravian.aero.util.Ips;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||||
|
@CommandParameters(description = "Executive things...", usage = "/<command> [hell: <username>]", aliases = "exec")
|
||||||
|
public class Command_executive extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
if (!FUtil.isExecutive(sender.getName()))
|
||||||
|
{
|
||||||
|
msg("You aren't an executive, have a cookie instead!");
|
||||||
|
if (!senderIsConsole)
|
||||||
|
{
|
||||||
|
final int firstEmpty = playerSender.getInventory().firstEmpty();
|
||||||
|
final ItemStack cakeItem = new ItemStack(Material.COOKIE);
|
||||||
|
playerSender.getInventory().setItem(firstEmpty, cakeItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("Sorry, you're not an in-game player, so it's impossible to give you a cookie :(");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args.length > 0)
|
||||||
|
{
|
||||||
|
switch (args[0])
|
||||||
|
{
|
||||||
|
case "hell":
|
||||||
|
{
|
||||||
|
if (args.length == 2)
|
||||||
|
{
|
||||||
|
if (getPlayer(args[1]) == null)
|
||||||
|
{
|
||||||
|
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final Player player = getPlayer(args[1]);
|
||||||
|
|
||||||
|
FUtil.adminAction(sender.getName(), "Calling Satan to open the gates of hell for " + player.getName(), true);
|
||||||
|
FUtil.bcastMsg(player.getName() + " is going to have a bad time!", ChatColor.RED);
|
||||||
|
final String IP = player.getAddress().getAddress().getHostAddress().trim();
|
||||||
|
if (plugin.al.isAdmin(player))
|
||||||
|
{
|
||||||
|
Admin admin = plugin.al.getAdmin(player);
|
||||||
|
admin.setActive(false);
|
||||||
|
plugin.al.save();
|
||||||
|
plugin.al.updateTables();
|
||||||
|
}
|
||||||
|
player.setVelocity(new Vector(0, Math.max(1.0, Math.min(150, 30)), 0));
|
||||||
|
player.setWhitelisted(false);
|
||||||
|
player.setOp(false);
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
player.closeInventory();
|
||||||
|
player.getInventory().clear();
|
||||||
|
player.setFireTicks(10000);
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_DEATH, 100, -1f);
|
||||||
|
player.getEnderChest().clear();
|
||||||
|
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.DOOM, null));
|
||||||
|
new BukkitRunnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
player.getWorld().strikeLightning(player.getLocation());
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 20L * 2L);
|
||||||
|
new BukkitRunnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
player.getWorld().strikeLightning(player.getLocation());
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 20L * 2L);
|
||||||
|
FUtil.bcastMsg("The gates to hell have opened, let the wrath of " + sender.getName() + " condem " + player.getName() + "!", ChatColor.RED);
|
||||||
|
player.setFireTicks(10000);
|
||||||
|
final CommandSender cSender = sender;
|
||||||
|
new BukkitRunnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
banPlayer(player.getName(), "Get your fucking shit together and then call back kthx", true, false);
|
||||||
|
FUtil.adminAction(cSender.getName(), "Has sent " + player.getName() + " to hell, IP: " + IP, true);
|
||||||
|
player.kickPlayer(ChatColor.RED + "Welcome to hell you fucking cuck");
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 40L * 4L);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public void banPlayer(String playerName, String reason, Boolean silent, Boolean kick)
|
||||||
|
{
|
||||||
|
PlayerData playerData = plugin.pl.getData(playerName);
|
||||||
|
final List<String> ips = new ArrayList<>();
|
||||||
|
ips.addAll(playerData.getIps());
|
||||||
|
String username;
|
||||||
|
final Player player = getPlayer(args[1]);
|
||||||
|
username = playerName;
|
||||||
|
if (!silent)
|
||||||
|
{
|
||||||
|
FUtil.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
|
||||||
|
}
|
||||||
|
Ban ban = Ban.forPlayerName(username, sender, null, reason);
|
||||||
|
for (String ip : ips)
|
||||||
|
{
|
||||||
|
ban.addIp(ip);
|
||||||
|
ban.addIp(FUtil.getFuzzyIp(ip));
|
||||||
|
}
|
||||||
|
plugin.bm.addBan(ban);
|
||||||
|
|
||||||
|
if (player != null && kick)
|
||||||
|
{
|
||||||
|
player.kickPlayer(ban.bakeKickMessage(Ips.getIp(player)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
|
@CommandParameters(description = "i dont fucking know, what even", usage = "thot if you dont know what this does then dont use it")
|
||||||
|
public class Command_idfk extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public static final String[] DRUNK_LINES = new String[]{"i is thy best bitch in teh world xD xD xD",
|
||||||
|
"ooga boga ooga boga ooga boga ooga boga", "jake u dog fukr", "nero is a nice black pussy",
|
||||||
|
"robin has a perfect penis", "ABABABABABABABABABA ABAOBOABOBA", "agge is a fuckin egg",
|
||||||
|
"explosive errors == explosive arrows", "sync; echo 3 > /proc/sys/vm/drop_caches", "yeet",
|
||||||
|
"si", "bubble bass thicc :weary::sweat_drops: :ok_hand:", "diabeetus", "McDiabeto", "oh",
|
||||||
|
"say heck to diabetes im having chocolate cake"};
|
||||||
|
|
||||||
|
private static final Random random = new Random();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (args[0])
|
||||||
|
{
|
||||||
|
case "killmepls":
|
||||||
|
playerSender.setHealth(0);
|
||||||
|
msg("ok u wanted die u now die");
|
||||||
|
break;
|
||||||
|
case "robin":
|
||||||
|
msg("robin is a meme xD xD xD");
|
||||||
|
break;
|
||||||
|
case "succ":
|
||||||
|
playerSender.chat("mmmmm *suckle* *suckle* daddy");
|
||||||
|
break;
|
||||||
|
case "drunk":
|
||||||
|
msg(DRUNK_LINES[random.nextInt(DRUNK_LINES.length)]);
|
||||||
|
break;
|
||||||
|
case "zero":
|
||||||
|
msg("WATCH ZERO KARA HAJIMERU MAHOU NO SHO (GRIMOIRE OF ZERO) TODAY! https://kissanime.ru/anime/zero-kara-hajimeru-mahou-no-sho");
|
||||||
|
break;
|
||||||
|
case "boom":
|
||||||
|
msg("allahu akbar bitch");
|
||||||
|
playerSender.getWorld().createExplosion(playerSender.getLocation(), 0F);
|
||||||
|
break;
|
||||||
|
case "rocket":
|
||||||
|
playerSender.setVelocity(new Vector(0, 1000, 0));
|
||||||
|
msg("*insert shooting stars meme here*");
|
||||||
|
break;
|
||||||
|
case "fuck":
|
||||||
|
playerSender.chat("wow robin is gay xdxdxd");
|
||||||
|
msg("i tried");
|
||||||
|
msg("and as in i tried as in robin tried to code this in");
|
||||||
|
msg("lol xd");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||||
|
@CommandParameters(description = "Check the stats of the server", usage = "/<command>", aliases = "ss")
|
||||||
|
public class Command_serverstats extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
msg("-==" + ConfigEntry.SERVER_NAME.getString() + " server stats==-", ChatColor.GOLD);
|
||||||
|
msg("Total opped players: " + server.getOperators().size(), ChatColor.RED);
|
||||||
|
msg("Total staff: " + plugin.al.getAllAdmins().size() + " (" + plugin.al.getActiveAdmins().size() + " active)", ChatColor.BLUE);
|
||||||
|
int tpbips = plugin.pm.getPermbannedIps().size();
|
||||||
|
int tpbns = plugin.pm.getPermbannedNames().size();
|
||||||
|
int tpbs = tpbips + tpbns;
|
||||||
|
msg("Total perm bans: " + tpbs + " (" + tpbips + " ips " + tpbns + " names)", ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -63,7 +63,7 @@ public class Command_stfu extends FreedomCommand
|
|||||||
if (info.isMuted())
|
if (info.isMuted())
|
||||||
{
|
{
|
||||||
info.setMuted(false);
|
info.setMuted(false);
|
||||||
mp.sendTitle(ChatColor.RED + "You've been unmuted.", ChatColor.YELLOW + "Be sure to follow the rules!" + args, 20, 100, 60);
|
mp.sendTitle(ChatColor.RED + "You've been unmuted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ public class Command_stfu extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (!plugin.al.isAdmin(player))
|
if (!plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
player.sendTitle(ChatColor.RED + "You've been muted globally.", ChatColor.YELLOW + "Please be patient and you will be unmuted shortly." + args, 20, 100, 60);
|
player.sendTitle(ChatColor.RED + "You've been muted globally.", ChatColor.YELLOW + "Please be patient and you will be unmuted shortly.", 20, 100, 60);
|
||||||
playerdata = plugin.pl.getPlayer(player);
|
playerdata = plugin.pl.getPlayer(player);
|
||||||
playerdata.setMuted(true);
|
playerdata.setMuted(true);
|
||||||
counter++;
|
counter++;
|
||||||
@ -163,7 +163,7 @@ public class Command_stfu extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||||
player.sendTitle(ChatColor.RED + "You've been muted.", ChatColor.YELLOW + "Be sure to follow the rules!" + args, 20, 100, 60);
|
player.sendTitle(ChatColor.RED + "You've been muted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||||
if (reason != null)
|
if (reason != null)
|
||||||
{
|
{
|
||||||
msg(player, "Reason: " + ChatColor.YELLOW + reason);
|
msg(player, "Reason: " + ChatColor.YELLOW + reason);
|
||||||
|
@ -62,6 +62,12 @@ public class RankManager extends FreedomService
|
|||||||
return Title.DEVELOPER;
|
return Title.DEVELOPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Contributors always show up
|
||||||
|
if (FUtil.CONTRIBUTORS.contains(player.getName()))
|
||||||
|
{
|
||||||
|
return Title.CONTRIBUTOR;
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) && plugin.al.isAdmin(player))
|
if (ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) && plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
return Title.EXECUTIVE;
|
return Title.EXECUTIVE;
|
||||||
|
@ -11,6 +11,7 @@ public enum Title implements Displayable
|
|||||||
ASSISTANT_EXECUTIVE("an", "Assistant Executive", ChatColor.RED, "Asst Exec"),
|
ASSISTANT_EXECUTIVE("an", "Assistant Executive", ChatColor.RED, "Asst Exec"),
|
||||||
EXECUTIVE("an", "Executive", ChatColor.RED, "Exec"),
|
EXECUTIVE("an", "Executive", ChatColor.RED, "Exec"),
|
||||||
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"),
|
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"),
|
||||||
|
CONTRIBUTOR("a", "TotalFreedom Contributor", ChatColor.DARK_PURPLE, "Contributor"),
|
||||||
OWNER("the", "Owner", ChatColor.DARK_RED, "Owner");
|
OWNER("the", "Owner", ChatColor.DARK_RED, "Owner");
|
||||||
|
|
||||||
private final String determiner;
|
private final String determiner;
|
||||||
|
@ -48,7 +48,8 @@ public class FUtil
|
|||||||
//
|
//
|
||||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||||
// See https://github.com/TotalFreedom/License - None of the listed names may be removed.
|
// See https://github.com/TotalFreedom/License - None of the listed names may be removed.
|
||||||
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "OxLemonxO", "Wild1145", "Catholic_Mario", "Arcaknight", "smartnt", "supernt");
|
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "Catholic_Mario", "Arcaknight", "smartnt");
|
||||||
|
public static final List<String> CONTRIBUTORS = Arrays.asList("supernt", "OxLemonxO", "AcidicCyanide", "aggelosQQ");
|
||||||
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
|
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 Map<String, ChatColor> CHAT_COLOR_NAMES = new HashMap<>();
|
||||||
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(
|
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(
|
||||||
|
Loading…
Reference in New Issue
Block a user