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);
cpb = bridges.registerService(CoreProtectBridge.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);
web = bridges.registerService(WorldEditBridge.class);
//wgb = bridges.registerService(WorldGuardBridge.class);
wgb = bridges.registerService(WorldGuardBridge.class);
amp = bridges.registerService(AMP.class);
bridges.start();

View File

@ -221,9 +221,9 @@ public class EventBlocker extends FreedomService
{
BlockStateMeta blockStateMeta = (BlockStateMeta)item.getItemMeta();
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);
break;

View File

@ -18,7 +18,7 @@ public class Command_admininfo extends FreedomCommand
@Override
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())
{

View File

@ -7,8 +7,8 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, 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")
@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> <[partialname] | -a>", aliases = "gms")
public class Command_adventure extends FreedomCommand
{
@ -28,6 +28,8 @@ public class Command_adventure extends FreedomCommand
return true;
}
checkRank(Rank.SUPER_ADMIN);
if (args[0].equals("-a"))
{
for (Player targetPlayer : server.getOnlinePlayers())
@ -47,10 +49,9 @@ public class Command_adventure extends FreedomCommand
return true;
}
msg("Setting " + player.getName() + " to game mode adventure");
msg(player, sender.getName() + " set your game mode to adventure");
msg("Setting " + player.getName() + " to game mode adventure.");
msg(player, sender.getName() + " set your game mode to adventure.");
player.setGameMode(GameMode.ADVENTURE);
return true;
}
}

View File

@ -11,41 +11,61 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@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
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
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));
FUtil.adminAction(sender.getName(), "Cleared chat", true);
return true;
}
if (args.length != 1)
for (Player player : server.getOnlinePlayers())
{
return false;
boolean optedOut = false;
if (plugin.al.isAdmin(player))
{
optedOut = true;
}
if (plugin.mbl.isMasterBuilder(playerSender))
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);
}
else if (plugin.mbl.isMasterBuilder(playerSender))
{
MasterBuilder mb = plugin.mbl.getMasterBuilder(playerSender);
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.updateTables();
return true;
}
if (plugin.pv.getVerificationPlayer(playerSender).getEnabled())
else if (plugin.pv.getVerificationPlayer(playerSender).getEnabled())
{
VPlayer vp = plugin.pv.getVerificationPlayer(playerSender);
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);
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;
}
}

View File

@ -41,6 +41,12 @@ public class Command_deop extends FreedomCommand
player.setOp(false);
if (player.isOnline())
{
Player p = (Player)player;
p.sendMessage(YOU_ARE_NOT_OP);
}
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);
player.setOp(true);
if (player.isOnline())
{
Player p = (Player)player;
p.sendMessage(YOU_ARE_OP);
}
return true;
}
}

View File

@ -61,7 +61,7 @@ public class Command_smite extends FreedomCommand
{
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
player.setOp(false);

View File

@ -95,7 +95,8 @@ public enum ConfigEntry
OVERLORD_IPS(List.class, "overlord_ips"),
NOADMIN_IPS(List.class, "noadmin_ips"),
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"),
//
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"));
discordID = cs.getString("discord_id", null);
tag = cs.getString("tag", null);
clearChatOptOut = cs.getBoolean("clearchatoptout", false);
clearChatOptOut = cs.getBoolean("clearChatOptOut", false);
}
@Override
@ -96,7 +96,7 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
cs.set("last_login", FUtil.dateToString(lastLogin));
cs.set("discord_id", discordID);
cs.set("tag", tag);
cs.set("clearchatoptout", clearChatOptOut);
cs.set("clearChatOptOut", clearChatOptOut);
}
public void addIp(String ip)

View File

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

View File

@ -287,6 +287,15 @@ admininfo:
- ' &2- And apply on our forums at the link:'
- ' &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:
- honeydew