This commit is contained in:
ZeroEpoch1969 2018-12-29 12:41:48 -07:00
parent 7a43f991e3
commit 72db71b3cf
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
16 changed files with 187 additions and 61 deletions

View File

@ -27,25 +27,24 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:c213295f95" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:89efd2c93e" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldEdit:2e79570525" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:2e79570525" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldEdit:c0f82ebeff" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:c0f82ebeff" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:dummypermscompat:1.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:2e79570525" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:c0f82ebeff" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:jchronic:0.2.4a" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.thoughtworks.paranamer:paranamer:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.lib:jlibnoise:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sk89q.bukkit:bukkit-classloader-check:1.7.9-R0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.7.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:16.0.1" level="project" />
@ -63,7 +62,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:6.2" level="project" />
</component>
</module>

View File

@ -123,14 +123,14 @@
<dependency>
<groupId>com.github.TFPatches</groupId>
<artifactId>TF-LibsDisguises</artifactId>
<version>c213295f95</version>
<version>89efd2c93e</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TFPatches</groupId>
<artifactId>TF-WorldEdit</artifactId>
<version>2e79570525</version>
<version>c0f82ebeff</version>
<scope>provided</scope>
</dependency>
@ -144,7 +144,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.13.1-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -223,7 +223,7 @@ public class LoginProcess extends FreedomService
{
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
{
player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
player.sendMessage(ChatColor.RED + "Server is currently closed to non-admins.");
}
if (lockdownEnabled)

View File

@ -246,8 +246,8 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
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);
ldb = bridges.registerService(LibsDisguisesBridge.class);
web = bridges.registerService(WorldEditBridge.class);
//wgb = bridges.registerService(WorldGuardBridge.class);
amp = bridges.registerService(AMP.class);
bridges.start();

View File

@ -9,6 +9,7 @@ import me.totalfreedom.totalfreedommod.util.MaterialGroup;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Dispenser;
import org.bukkit.block.ShulkerBox;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -126,4 +127,28 @@ public class BlockBlocker extends FreedomService
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onDispenserPlace(BlockPlaceEvent event)
{
Block block = event.getBlock();
if (block.getType().equals(Material.DISPENSER))
{
Dispenser dispenser = (Dispenser)block.getState();
boolean empty = true;
for (ItemStack itemStack : dispenser.getInventory().getContents())
{
if (itemStack != null)
{
empty = false;
break;
}
}
if (!empty)
{
dispenser.getInventory().clear();
event.getPlayer().sendMessage(ChatColor.RED + "For security reasons, dispenser has been emptied.");
}
}
}
}

View File

@ -3,6 +3,15 @@ package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.Dispenser;
import org.bukkit.block.ShulkerBox;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Tameable;
import org.bukkit.event.EventHandler;
@ -21,6 +30,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FireworkExplodeEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack;
public class EventBlocker extends FreedomService
{
@ -194,4 +205,62 @@ public class EventBlocker extends FreedomService
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerRespawn(PlayerRespawnEvent event)
{
double maxHealth = event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
if (maxHealth < 1)
{
for (AttributeModifier attributeModifier : event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getModifiers())
{
event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).removeModifier(attributeModifier);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onBlockDispense(BlockDispenseEvent event)
{
if (event.getBlock() instanceof ShulkerBox)
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onEntityBlockForm(EntityBlockFormEvent event)
{
FLog.info("block form by entity fired");
if (event.getBlock() instanceof Dispenser)
{
Dispenser dispenser = (Dispenser)event.getBlock();
ItemStack[] items = dispenser.getInventory().getContents();
for (ItemStack item : items)
{
if (item != null && MaterialGroup.SHULKER_BOXES.contains(item.getType()))
{
dispenser.getInventory().clear();
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onBlockForm(BlockFormEvent event)
{
FLog.info("block form fired");
if (event.getBlock() instanceof Dispenser)
{
Dispenser dispenser = (Dispenser)event.getBlock();
ItemStack[] items = dispenser.getInventory().getContents();
for (ItemStack item : items)
{
if (item != null && MaterialGroup.SHULKER_BOXES.contains(item.getType()))
{
dispenser.getInventory().clear();
}
}
}
}
}

View File

@ -2,8 +2,7 @@ package me.totalfreedom.totalfreedommod.bridge;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.LibsDisguises;
import me.totalfreedom.libsdisguise.DisallowedDisguises;
import me.totalfreedom.libsdisguise.TF_DisguiseAPI;
import me.totalfreedom.disguise.DisguiseBlocker;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
@ -109,19 +108,12 @@ public class LibsDisguisesBridge extends FreedomService
return;
}
if (state)
{
TF_DisguiseAPI.enableDisguises();
}
else
{
TF_DisguiseAPI.disableDisguises();
}
libsDisguises.toggleUsability(state);
}
public boolean isDisguisesEnabled()
{
return !DisallowedDisguises.disabled;
return DisguiseBlocker.enabled;
}
public boolean isEnabled()

View File

@ -70,7 +70,8 @@ public class WorldEditBridge extends FreedomService
{
for (int i = 0; i < count; i++)
{
session.undo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
com.sk89q.worldedit.entity.Player fuckyou = (com.sk89q.worldedit.entity.Player)bukkitPlayer;
session.undo(session.getBlockBag(fuckyou), fuckyou);
}
}
}
@ -93,7 +94,8 @@ public class WorldEditBridge extends FreedomService
{
for (int i = 0; i < count; i++)
{
session.redo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
com.sk89q.worldedit.entity.Player fuckyou = (com.sk89q.worldedit.entity.Player)bukkitPlayer;
session.redo(session.getBlockBag(fuckyou), fuckyou);
}
}
}
@ -121,6 +123,30 @@ public class WorldEditBridge extends FreedomService
}
public int getDefaultLimit()
{
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep == null)
{
return 0;
}
return wep.getLocalConfiguration().defaultChangeLimit;
}
public int getMaxLimit()
{
final WorldEditPlugin wep = getWorldEditPlugin();
if (wep == null)
{
return 0;
}
return wep.getLocalConfiguration().maxChangeLimit;
}
private LocalSession getPlayerSession(Player player)
{
final WorldEditPlugin wep = getWorldEditPlugin();

View File

@ -206,10 +206,16 @@ public class CageData
block.setType(Material.PLAYER_HEAD);
if (input != null)
{
Skull skull = (Skull)block.getState();
// This may or may not work in future versions of spigot
skull.setOwner(input);
skull.update();
try
{
Skull skull = (Skull)block.getState();
// This may or may not work in future versions of spigot
skull.setOwner(input);
skull.update();
}
catch (ClassCastException e)
{
}
}
}
}

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.libsdisguise.DisallowedDisguises;
import me.totalfreedom.disguise.DisguiseBlocker;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
@ -21,8 +21,7 @@ public class Command_disguisetoggle extends FreedomCommand
return true;
}
FUtil.adminAction(sender.getName(), (DisallowedDisguises.disabled ? "Enabling" : "Disabling")
+ " disguises", false);
FUtil.adminAction(sender.getName(), (DisguiseBlocker.enabled ? "Disabling" : "Enabling") + " disguises", false);
if (plugin.ldb.isDisguisesEnabled())
{
@ -34,7 +33,7 @@ public class Command_disguisetoggle extends FreedomCommand
plugin.ldb.setDisguisesEnabled(true);
}
msg("Disguises are now " + (!DisallowedDisguises.disabled ? "enabled." : "disabled."));
msg("Disguises are now " + (DisguiseBlocker.enabled ? "enabled." : "disabled."));
return true;
}

View File

@ -14,12 +14,12 @@ public class Command_setlimit extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
int amount = 100000;
int amount = plugin.web.getDefaultLimit();
if (args.length > 0)
{
try
{
amount = Math.max(1, Math.min(200000, Integer.parseInt(args[0])));
amount = Math.max(1, Math.min(plugin.web.getMaxLimit(), Integer.parseInt(args[0])));
}
catch (NumberFormatException ex)
{

View File

@ -151,16 +151,18 @@ public class Command_tag extends FreedomCommand
});
final String outputTag = FUtil.colorize(strippedTag);
int tagLimit = (plugin.al.isAdmin(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(strippedTag).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + String.valueOf(tagLimit) + " characters).");
return true;
}
if (!plugin.al.isAdmin(sender))
{
final String rawTag = ChatColor.stripColor(outputTag).toLowerCase();
if (rawTag.length() > 20)
{
msg("That tag is too long (Max is 20 characters).");
return true;
}
for (String word : FORBIDDEN_WORDS)
{
if (rawTag.contains(word))

View File

@ -31,16 +31,18 @@ public class Command_tagnyan extends FreedomCommand
String tagStr = tag.toString();
int tagLimit = (plugin.al.isAdmin(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(tagStr).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + String.valueOf(tagLimit) + " characters).");
return true;
}
if (!plugin.al.isAdmin(sender))
{
final String rawTag = ChatColor.stripColor(tagStr).toLowerCase();
if (rawTag.length() > 20)
{
msg("That tag is too long (Max is 20 characters).");
return true;
}
for (String word : Command_tag.FORBIDDEN_WORDS)
{
if (rawTag.contains(word))

View File

@ -1,6 +1,6 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.libsdisguise.DisallowedDisguises;
import me.totalfreedom.disguise.DisguiseBlocker;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Undisguise all players on the server", usage = "/<command>", aliases = "uall")
@CommandParameters(description = "Undisguise all players on the server", usage = "/<command> [-a]", aliases = "uall")
public class Command_undisguiseall extends FreedomCommand
{
@ -21,15 +21,22 @@ public class Command_undisguiseall extends FreedomCommand
return true;
}
if (DisallowedDisguises.disabled)
if (!DisguiseBlocker.enabled)
{
msg("Disguises are not enabled.");
return true;
}
FUtil.adminAction(sender.getName(), "Undisguising all non-admins", true);
boolean admins = false;
plugin.ldb.undisguiseAll(false);
if (args.length > 0 && args[0].equalsIgnoreCase("-a"))
{
admins = true;
}
FUtil.adminAction(sender.getName(), "Undisguising all " + (admins ? "players" : "non-admins"), true);
plugin.ldb.undisguiseAll(admins);
return true;
}

View File

@ -44,7 +44,7 @@ public class Command_vanish extends FreedomCommand
}
if (!silent)
{
FUtil.bcastMsg(ChatColor.AQUA + playerSender.getName() + " is " + loginMsg);
FUtil.bcastMsg(ChatColor.AQUA + (loginMsg.contains("%name%") ? "" : playerSender.getName() + " is ") + FUtil.colorize(loginMsg).replace("%name%", playerSender.getName()));
FUtil.bcastMsg(playerSender.getName() + " joined the game", ChatColor.YELLOW);
}
if (admin.getTag() != null)

View File

@ -37,7 +37,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.
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "aggelosQQ", "OxLemonxO", "Wild1145", "ZeroEpoch1969", "Mafrans");
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "aggelosQQ", "OxLemonxO", "Wild1145", "Catholic_Mario");
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(