mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-30 13:27:37 +00:00
ride for ops, 4chan, and more toggles
This commit is contained in:
parent
2c99a8e4f4
commit
5206ab5b27
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
@ -77,6 +78,21 @@ public class ChatManager extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for 4chan trigger
|
||||
Boolean green = ChatColor.stripColor(message).toLowerCase().startsWith(">");
|
||||
Boolean orange = ChatColor.stripColor(message).toLowerCase().endsWith("<");
|
||||
if (ConfigEntry.FOURCHAN_ENABLED.getBoolean())
|
||||
{
|
||||
if (green)
|
||||
{
|
||||
message = ChatColor.GREEN + message;
|
||||
}
|
||||
else if (orange)
|
||||
{
|
||||
message = ChatColor.GOLD + message;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, set message
|
||||
event.setMessage(message);
|
||||
|
||||
|
@ -91,37 +91,52 @@ public class BlockBlocker extends FreedomService
|
||||
}
|
||||
case STRUCTURE_BLOCK:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
if (!ConfigEntry.ALLOW_STRUCTURE_BLOCKS.getBoolean())
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JIGSAW:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
if (!ConfigEntry.ALLOW_JIGSAWS.getBoolean())
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GRINDSTONE:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Grindstones are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Grindstones are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JUKEBOX:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Jukeboxes are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
if (!ConfigEntry.ALLOW_JUKEBOXES.getBoolean())
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Jukeboxes are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPAWNER:
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Spawners are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
if (!ConfigEntry.ALLOW_SPAWNERS.getBoolean())
|
||||
{
|
||||
player.sendMessage(ChatColor.GRAY + "Spawners are disabled.");
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Make other people your bitch.", usage = "/<command> <playername>")
|
||||
public class Command_ride extends FreedomCommand
|
||||
{
|
||||
@ -20,6 +21,15 @@ public class Command_ride extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
VPlayer vPlayerSender = plugin.pv.getVerificationPlayer(playerSender);
|
||||
vPlayerSender.setRideToggle(!vPlayerSender.isRideToggle());
|
||||
plugin.pv.saveVerificationData(vPlayerSender);
|
||||
msg("Other players n" + (vPlayerSender.isRideToggle() ? "ow" : "o longer") + " have the ability to ride you.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
@ -27,12 +37,20 @@ public class Command_ride extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
final VPlayer vPlayer = plugin.pv.getVerificationPlayer(player);
|
||||
|
||||
if (player == playerSender)
|
||||
{
|
||||
msg("You can't ride yourself. smh.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!vPlayer.isRideToggle() && !isAdmin(sender))
|
||||
{
|
||||
msg("That player cannot be ridden.", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
player.addPassenger(playerSender);
|
||||
|
||||
return true;
|
||||
|
@ -41,6 +41,12 @@ public class Command_toggle extends FreedomCommand
|
||||
msg("- armorstands");
|
||||
msg("- clearonjoin");
|
||||
msg("- tpronjoin");
|
||||
msg("- structureblocks");
|
||||
msg("- jigsaws");
|
||||
msg("- grindstones");
|
||||
msg("- jukeboxes");
|
||||
msg("- spawners");
|
||||
msg("- 4chan");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -183,6 +189,36 @@ public class Command_toggle extends FreedomCommand
|
||||
toggle("The random teleporting of players on join is", ConfigEntry.ALLOW_TPR_ON_JOIN);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("structureblocks"))
|
||||
{
|
||||
toggle("Structure blocks are", ConfigEntry.ALLOW_STRUCTURE_BLOCKS);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("jigsaws"))
|
||||
{
|
||||
toggle("Jigsaws are", ConfigEntry.ALLOW_JIGSAWS);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("grindstones"))
|
||||
{
|
||||
toggle("Grindstones are", ConfigEntry.ALLOW_GRINDSTONES);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("jukeboxes"))
|
||||
{
|
||||
toggle("Jukeboxes are", ConfigEntry.ALLOW_JUKEBOXES);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("spawners"))
|
||||
{
|
||||
toggle("Spawners are", ConfigEntry.ALLOW_SPAWNERS);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("4chan"))
|
||||
{
|
||||
toggle("4chan mode is", ConfigEntry.FOURCHAN_ENABLED);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -201,7 +237,8 @@ public class Command_toggle extends FreedomCommand
|
||||
{
|
||||
return Arrays.asList(
|
||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs", "bells", "armorstands", "clearonjoin", "tpronjoin");
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
||||
"bells", "armorstands", "clearonjoin", "tpronjoin", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
|
@ -24,9 +24,14 @@ public enum ConfigEntry
|
||||
ALLOW_UNSAFE_ENCHANTMENTS(Boolean.class, "allow.unsafe_enchantments"),
|
||||
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
||||
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
|
||||
ALLOW_MINECARTS (Boolean.class, "allow.minecarts"),
|
||||
ALLOW_MINECARTS(Boolean.class, "allow.minecarts"),
|
||||
ALLOW_CLEAR_ON_JOIN(Boolean.class, "allow.clearonjoin"),
|
||||
ALLOW_TPR_ON_JOIN(Boolean.class, "allow.tpronjoin"),
|
||||
ALLOW_STRUCTURE_BLOCKS(Boolean.class, "allow.structureblocks"),
|
||||
ALLOW_JIGSAWS(Boolean.class, "allow.jigsaws"),
|
||||
ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"),
|
||||
ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"),
|
||||
ALLOW_SPAWNERS(Boolean.class, "allow.spawners"),
|
||||
//
|
||||
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
||||
//
|
||||
@ -91,6 +96,7 @@ public enum ConfigEntry
|
||||
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
|
||||
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
||||
MP44_ENABLED(Boolean.class, "mp44_enabled"),
|
||||
FOURCHAN_ENABLED(Boolean.class, "4chan_enabled"),
|
||||
//
|
||||
PROTECTAREA_ENABLED(Boolean.class, "protectarea.enabled"),
|
||||
PROTECTAREA_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
|
||||
|
@ -34,6 +34,9 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean clearChatOptOut = false;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean rideToggle = true;
|
||||
|
||||
public VPlayer(String name)
|
||||
{
|
||||
@ -55,6 +58,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
enabled = cs.getBoolean("enabled", false);
|
||||
tag = cs.getString("tag", null);
|
||||
clearChatOptOut = cs.getBoolean("clearChatOptOut", false);
|
||||
rideToggle = cs.getBoolean("rideToggle", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,6 +71,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
||||
cs.set("tag", tag);
|
||||
cs.set("ips", Lists.newArrayList(ips));
|
||||
cs.set("clearChatOptOut", clearChatOptOut);
|
||||
cs.set("rideToggle", rideToggle);
|
||||
}
|
||||
|
||||
public List<String> getIps()
|
||||
|
@ -133,6 +133,11 @@ allow:
|
||||
minecarts: false
|
||||
clearonjoin: false
|
||||
tpronjoin: false
|
||||
structureblocks: false
|
||||
jigsaws: false
|
||||
grindstones: false
|
||||
jukeboxes: false
|
||||
spawners: false
|
||||
|
||||
# Blocked commands:
|
||||
#
|
||||
@ -264,6 +269,7 @@ disable:
|
||||
landmines_enabled: false
|
||||
mp44_enabled: false
|
||||
tossmob_enabled: false
|
||||
4chan_enabled: false
|
||||
|
||||
# Moblimiter
|
||||
moblimiter:
|
||||
|
Loading…
Reference in New Issue
Block a user