This commit is contained in:
ZeroEpoch1969 2019-01-11 20:05:12 -07:00
parent 3754222582
commit 93d4c9654e
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
13 changed files with 136 additions and 60 deletions

View File

@ -245,10 +245,9 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
btb = bridges.registerService(BukkitTelnetBridge.class); btb = bridges.registerService(BukkitTelnetBridge.class);
cpb = bridges.registerService(CoreProtectBridge.class); cpb = bridges.registerService(CoreProtectBridge.class);
esb = bridges.registerService(EssentialsBridge.class); esb = bridges.registerService(EssentialsBridge.class);
// Disabled so I can at least load TFM as these plugins aren't updated
ldb = bridges.registerService(LibsDisguisesBridge.class); ldb = bridges.registerService(LibsDisguisesBridge.class);
web = bridges.registerService(WorldEditBridge.class); web = bridges.registerService(WorldEditBridge.class);
//wgb = bridges.registerService(WorldGuardBridge.class); wgb = bridges.registerService(WorldGuardBridge.class);
amp = bridges.registerService(AMP.class); amp = bridges.registerService(AMP.class);
bridges.start(); bridges.start();

View File

@ -221,12 +221,12 @@ public class EventBlocker extends FreedomService
{ {
BlockStateMeta blockStateMeta = (BlockStateMeta)item.getItemMeta(); BlockStateMeta blockStateMeta = (BlockStateMeta)item.getItemMeta();
ShulkerBox shulkerBox = (ShulkerBox)blockStateMeta.getBlockState(); ShulkerBox shulkerBox = (ShulkerBox)blockStateMeta.getBlockState();
for(ItemStack item : shulkerBox.getInventory().getContents) for (ItemStack itemStack : shulkerBox.getInventory().getContents())
{ {
if(item != null) if (itemStack != null)
{ {
event.setCancelled(true); event.setCancelled(true);
break; break;
} }
} }
} }

View File

@ -18,7 +18,7 @@ public class Command_admininfo 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)
{ {
List<String> adminInfo = ConfigEntry.ADMININFO.getStringList(); List<String> adminInfo = ConfigEntry.ADMIN_INFO.getStringList();
if (adminInfo.isEmpty()) if (adminInfo.isEmpty())
{ {

View File

@ -7,8 +7,8 @@ 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.SUPER_ADMIN, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Quickly change your own gamemode to adventure, or define someone's username to change theirs.", usage = "/<command> <-a | [partialname]>", aliases = "gma") @CommandParameters(description = "Quickly change your own gamemode to adventure, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>", aliases = "gms")
public class Command_adventure extends FreedomCommand public class Command_adventure extends FreedomCommand
{ {
@ -28,6 +28,8 @@ public class Command_adventure extends FreedomCommand
return true; return true;
} }
checkRank(Rank.SUPER_ADMIN);
if (args[0].equals("-a")) if (args[0].equals("-a"))
{ {
for (Player targetPlayer : server.getOnlinePlayers()) for (Player targetPlayer : server.getOnlinePlayers())
@ -47,10 +49,9 @@ public class Command_adventure extends FreedomCommand
return true; return true;
} }
msg("Setting " + player.getName() + " to game mode adventure"); msg("Setting " + player.getName() + " to game mode adventure.");
msg(player, sender.getName() + " set your game mode to adventure"); msg(player, sender.getName() + " set your game mode to adventure.");
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
return true; return true;
} }
} }

View File

@ -11,41 +11,61 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Clear chat", usage = "/<command> [optout]", aliases = "cc") @CommandParameters(description = "Clear chat", usage = "/<command>", aliases = "cc")
public class Command_clearchat extends FreedomCommand public class Command_clearchat 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.al.isAdmin(playerSender)) if (plugin.al.isAdmin(playerSender))
{ {
server.getOnlinePlayers().stream().filter(player -> !plugin.al.isAdmin(player) || !plugin.pv.getVerificationPlayer(player).isClearChatOptOut() || !plugin.mbl.getMasterBuilder(player).isClearChatOptOut()).forEach(player -> IntStream.range(0, 100).mapToObj(i -> "").forEach(player::sendMessage)); for (Player player : server.getOnlinePlayers())
{
boolean optedOut = false;
if (plugin.al.isAdmin(player))
{
optedOut = true;
}
else if (plugin.mbl.isMasterBuilder(player) && plugin.mbl.getMasterBuilder(player).isClearChatOptOut())
{
optedOut = true;
}
else if (plugin.pv.getVerificationPlayer(player).getEnabled() && plugin.pv.getVerificationPlayer(player).isClearChatOptOut())
{
optedOut = true;
}
if (!optedOut)
{
IntStream.range(0, 100).mapToObj(i -> "").forEach(player::sendMessage);
}
}
FUtil.adminAction(sender.getName(), "Cleared chat", true); FUtil.adminAction(sender.getName(), "Cleared chat", true);
return true;
} }
if (args.length != 1) else if (plugin.mbl.isMasterBuilder(playerSender))
{
return false;
}
if (plugin.mbl.isMasterBuilder(playerSender))
{ {
MasterBuilder mb = plugin.mbl.getMasterBuilder(playerSender); MasterBuilder mb = plugin.mbl.getMasterBuilder(playerSender);
mb.setClearChatOptOut(!mb.isClearChatOptOut()); mb.setClearChatOptOut(!mb.isClearChatOptOut());
msg(mb.isClearChatOptOut() ? "Opted-out" : "Opted-in" + " to clear chat."); msg((mb.isClearChatOptOut() ? "Opted-out of" : "Opted-in to") + " clear chat.");
plugin.mbl.save(); plugin.mbl.save();
plugin.mbl.updateTables(); plugin.mbl.updateTables();
return true;
} }
if (plugin.pv.getVerificationPlayer(playerSender).getEnabled()) else if (plugin.pv.getVerificationPlayer(playerSender).getEnabled())
{ {
VPlayer vp = plugin.pv.getVerificationPlayer(playerSender); VPlayer vp = plugin.pv.getVerificationPlayer(playerSender);
vp.setClearChatOptOut(!vp.isClearChatOptOut()); vp.setClearChatOptOut(!vp.isClearChatOptOut());
msg(vp.isClearChatOptOut() ? "Opted-out" : "Opted-in" + " to clear chat."); msg((vp.isClearChatOptOut() ? "Opted-out of" : "Opted-in to") + " clear chat.");
plugin.pv.saveVerificationData(vp); plugin.pv.saveVerificationData(vp);
return true; return true;
} }
msg("Only Master Builders, and players with verification enabled can opt out of clear chat.", ChatColor.RED); else
{
msg("Only Master Builders, admins, and players with verification enabled can opt-out of clear chat.", ChatColor.RED);
}
return true; return true;
} }
} }

View File

@ -41,6 +41,12 @@ public class Command_deop extends FreedomCommand
player.setOp(false); player.setOp(false);
if (player.isOnline())
{
Player p = (Player)player;
p.sendMessage(YOU_ARE_NOT_OP);
}
return true; return true;
} }
} }

View File

@ -0,0 +1,34 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.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.BOTH)
@CommandParameters(description = "Information on how to apply for Master Builder.", usage = "/<command>", aliases = "mbi")
public class Command_masterbuilderinfo extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
List<String> masterBuilderInfo = ConfigEntry.MASTER_BUILDER_INFO.getStringList();
if (masterBuilderInfo.isEmpty())
{
msg("There is no Master Builder information set in the config.", ChatColor.RED);
}
else
{
msg(FUtil.colorize(StringUtils.join(masterBuilderInfo, "\n")));
}
return true;
}
}

View File

@ -55,6 +55,12 @@ public class Command_op extends FreedomCommand
FUtil.adminAction(sender.getName(), "Opping " + player.getName(), false); FUtil.adminAction(sender.getName(), "Opping " + player.getName(), false);
player.setOp(true); player.setOp(true);
if (player.isOnline())
{
Player p = (Player)player;
p.sendMessage(YOU_ARE_OP);
}
return true; return true;
} }
} }

View File

@ -61,7 +61,7 @@ public class Command_smite extends FreedomCommand
{ {
FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED); FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED);
} }
FUtil.bcastMsg(" Smited by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED); FUtil.bcastMsg(" Smitten by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
// Deop // Deop
player.setOp(false); player.setOp(false);

View File

@ -95,7 +95,8 @@ public enum ConfigEntry
OVERLORD_IPS(List.class, "overlord_ips"), OVERLORD_IPS(List.class, "overlord_ips"),
NOADMIN_IPS(List.class, "noadmin_ips"), NOADMIN_IPS(List.class, "noadmin_ips"),
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"), ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
ADMININFO(List.class, "admininfo"), ADMIN_INFO(List.class, "admininfo"),
MASTER_BUILDER_INFO(List.class, "masterbuilderinfo"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"), AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
// //
AMP_ENABLED(Boolean.class, "amp.enabled"), AMP_ENABLED(Boolean.class, "amp.enabled"),

View File

@ -84,7 +84,7 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
lastLogin = FUtil.stringToDate(cs.getString("last_login")); lastLogin = FUtil.stringToDate(cs.getString("last_login"));
discordID = cs.getString("discord_id", null); discordID = cs.getString("discord_id", null);
tag = cs.getString("tag", null); tag = cs.getString("tag", null);
clearChatOptOut = cs.getBoolean("clearchatoptout", false); clearChatOptOut = cs.getBoolean("clearChatOptOut", false);
} }
@Override @Override
@ -96,7 +96,7 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
cs.set("last_login", FUtil.dateToString(lastLogin)); cs.set("last_login", FUtil.dateToString(lastLogin));
cs.set("discord_id", discordID); cs.set("discord_id", discordID);
cs.set("tag", tag); cs.set("tag", tag);
cs.set("clearchatoptout", clearChatOptOut); cs.set("clearChatOptOut", clearChatOptOut);
} }
public void addIp(String ip) public void addIp(String ip)

View File

@ -54,7 +54,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
discordId = cs.getString("discordId", null); discordId = cs.getString("discordId", null);
enabled = cs.getBoolean("enabled", false); enabled = cs.getBoolean("enabled", false);
tag = cs.getString("tag", null); tag = cs.getString("tag", null);
clearChatOptOut = cs.getBoolean("clearchatoptout", false); clearChatOptOut = cs.getBoolean("clearChatOptOut", false);
} }
@Override @Override
@ -66,7 +66,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
cs.set("enabled", enabled); cs.set("enabled", enabled);
cs.set("tag", tag); cs.set("tag", tag);
cs.set("ips", Lists.newArrayList(ips)); cs.set("ips", Lists.newArrayList(ips));
cs.set("clearchatoptout", clearChatOptOut); cs.set("clearChatOptOut", clearChatOptOut);
} }
public List<String> getIps() public List<String> getIps()

View File

@ -254,38 +254,47 @@ announcer:
prefix: '&5[&eTotalFreedom&5] &b' prefix: '&5[&eTotalFreedom&5] &b'
announcements: announcements:
- 'Be sure to visit our forums at &6http://totalfreedom.boards.net/' - 'Be sure to visit our forums at &6http://totalfreedom.boards.net/'
- 'You can always review the server rules here: &6http://totalfreedom.me/' - 'You can always review the server rules here: &6http://totalfreedom.me/'
- 'If you are not OP, be sure to ask!' - 'If you are not OP, be sure to ask!'
- 'Somebody breaking the rules? Report it! /report <user> <reason>' - 'Somebody breaking the rules? Report it! /report <user> <reason>'
- 'Griefing is not allowed!' - 'Griefing is not allowed!'
- 'Hacked clients are allowed!' - 'Hacked clients are allowed!'
- 'Interested in becoming admin? Type "/ai" for more information!' - 'Interested in becoming admin? Type "/ai" for more information!'
- 'You may view all online administrators via "/list -a"' - 'You may view all online administrators via "/list -a"'
- 'Save your buildings via WorldEdit! http://totalfreedom.me for more information!' - 'Save your buildings via WorldEdit! http://totalfreedom.me for more information!'
- 'Famous players, such as Notch, are always fake! We are an offline/cracked server!' - 'Famous players, such as Notch, are always fake! We are an offline/cracked server!'
- 'You may contact TotalFreedom support on Twitter! https://tiny.re/tfsupport' - 'You may contact TotalFreedom support on Twitter! https://tiny.re/tfsupport'
- 'You may download TotalFreedomMod here: https://tiny.re/tfm+' - 'You may download TotalFreedomMod here: https://tiny.re/tfm+'
- 'TheMinecraft is the owner of TotalFreedom.' - 'TheMinecraft is the owner of TotalFreedom.'
- 'MarkByron is the founder of TotalFreedom.' - 'MarkByron is the founder of TotalFreedom.'
- 'Server lagging? Check the lag via "/tps"' - 'Server lagging? Check the lag via "/tps"'
- 'You are allowed to record and stream videos on TotalFreedom.' - 'You are allowed to record and stream videos on TotalFreedom.'
- 'Player vs player while in creative or god mode is forbidden!' - 'Player vs player while in creative or god mode is forbidden!'
- 'Spawn killing is forbidden!' - 'Spawn killing is forbidden!'
- 'Invisible potions are allowed!' - 'Invisible potions are allowed!'
- 'Serial griefing and trolling will result in a permanent ban!' - 'Serial griefing and trolling will result in a permanent ban!'
- 'TotalFreedom does not accept any form of donations!' - 'TotalFreedom does not accept any form of donations!'
- 'Racism, nazism, and sexism are strictly forbidden!' - 'Racism, nazism, and sexism are strictly forbidden!'
- 'Join our Discord server! Link: https://discordapp.com/invite/XXjmAmV/' - 'Join our Discord server! Link: https://discordapp.com/invite/XXjmAmV/'
# What to display in the admininfo command. # What to display in the admininfo command.
admininfo: admininfo:
- '&bHow to apply for admin on the TotalFreedom Server:' - '&bHow to apply for admin on the TotalFreedom Server:'
- ' &6- Do not ask for admin in game' - ' &6- Do not ask for admin in game'
- ' &2- Be helpful within the server' - ' &2- Be helpful within the server'
- ' &6- Report those breaking the rules' - ' &6- Report those breaking the rules'
- ' &2- And apply on our forums at the link:' - ' &2- And apply on our forums at the link:'
- ' &9www.totalfreedom.boards.net' - ' &9www.totalfreedom.boards.net'
# What to display in the Master Builder info command.
masterbuilderinfo:
- '&bHow to apply for Master Builder on the TotalFreedom Server:'
- ' &6- Do not ask for Master Builder in game'
- ' &2- Screenshot some of your previous builds (be ready to prove that the builds are yours)'
- ' &6- Copy the template and create a thread on our forums'
- ' &2- Template:'
- ' &9bit.ly/TFMasterBuilderTemplate'
# Famous players - cannot be banned by username # Famous players - cannot be banned by username
famous_players: famous_players: