mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +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 com.google.common.base.Strings;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
@ -77,6 +78,21 @@ public class ChatManager extends FreedomService
|
|||||||
return;
|
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
|
// Finally, set message
|
||||||
event.setMessage(message);
|
event.setMessage(message);
|
||||||
|
|
||||||
|
@ -91,37 +91,52 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
case STRUCTURE_BLOCK:
|
case STRUCTURE_BLOCK:
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
if (!ConfigEntry.ALLOW_STRUCTURE_BLOCKS.getBoolean())
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
{
|
||||||
event.setCancelled(true);
|
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JIGSAW:
|
case JIGSAW:
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
if (!ConfigEntry.ALLOW_JIGSAWS.getBoolean())
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
{
|
||||||
event.setCancelled(true);
|
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GRINDSTONE:
|
case GRINDSTONE:
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Grindstones are disabled.");
|
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
{
|
||||||
event.setCancelled(true);
|
player.sendMessage(ChatColor.GRAY + "Grindstones are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JUKEBOX:
|
case JUKEBOX:
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Jukeboxes are disabled.");
|
if (!ConfigEntry.ALLOW_JUKEBOXES.getBoolean())
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
{
|
||||||
event.setCancelled(true);
|
player.sendMessage(ChatColor.GRAY + "Jukeboxes are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPAWNER:
|
case SPAWNER:
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Spawners are disabled.");
|
if (!ConfigEntry.ALLOW_SPAWNERS.getBoolean())
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
{
|
||||||
event.setCancelled(true);
|
player.sendMessage(ChatColor.GRAY + "Spawners are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
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.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Make other people your bitch.", usage = "/<command> <playername>")
|
@CommandParameters(description = "Make other people your bitch.", usage = "/<command> <playername>")
|
||||||
public class Command_ride extends FreedomCommand
|
public class Command_ride extends FreedomCommand
|
||||||
{
|
{
|
||||||
@ -20,6 +21,15 @@ public class Command_ride extends FreedomCommand
|
|||||||
return false;
|
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]);
|
final Player player = getPlayer(args[0]);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@ -27,12 +37,20 @@ public class Command_ride extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final VPlayer vPlayer = plugin.pv.getVerificationPlayer(player);
|
||||||
|
|
||||||
if (player == playerSender)
|
if (player == playerSender)
|
||||||
{
|
{
|
||||||
msg("You can't ride yourself. smh.", ChatColor.RED);
|
msg("You can't ride yourself. smh.", ChatColor.RED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!vPlayer.isRideToggle() && !isAdmin(sender))
|
||||||
|
{
|
||||||
|
msg("That player cannot be ridden.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
player.addPassenger(playerSender);
|
player.addPassenger(playerSender);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -41,6 +41,12 @@ public class Command_toggle extends FreedomCommand
|
|||||||
msg("- armorstands");
|
msg("- armorstands");
|
||||||
msg("- clearonjoin");
|
msg("- clearonjoin");
|
||||||
msg("- tpronjoin");
|
msg("- tpronjoin");
|
||||||
|
msg("- structureblocks");
|
||||||
|
msg("- jigsaws");
|
||||||
|
msg("- grindstones");
|
||||||
|
msg("- jukeboxes");
|
||||||
|
msg("- spawners");
|
||||||
|
msg("- 4chan");
|
||||||
return false;
|
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);
|
toggle("The random teleporting of players on join is", ConfigEntry.ALLOW_TPR_ON_JOIN);
|
||||||
return true;
|
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
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -201,7 +237,8 @@ public class Command_toggle extends FreedomCommand
|
|||||||
{
|
{
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
"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();
|
return Collections.emptyList();
|
||||||
|
@ -24,9 +24,14 @@ public enum ConfigEntry
|
|||||||
ALLOW_UNSAFE_ENCHANTMENTS(Boolean.class, "allow.unsafe_enchantments"),
|
ALLOW_UNSAFE_ENCHANTMENTS(Boolean.class, "allow.unsafe_enchantments"),
|
||||||
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
||||||
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
|
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_CLEAR_ON_JOIN(Boolean.class, "allow.clearonjoin"),
|
||||||
ALLOW_TPR_ON_JOIN(Boolean.class, "allow.tpronjoin"),
|
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"),
|
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
||||||
//
|
//
|
||||||
@ -91,6 +96,7 @@ public enum ConfigEntry
|
|||||||
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
|
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
|
||||||
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
||||||
MP44_ENABLED(Boolean.class, "mp44_enabled"),
|
MP44_ENABLED(Boolean.class, "mp44_enabled"),
|
||||||
|
FOURCHAN_ENABLED(Boolean.class, "4chan_enabled"),
|
||||||
//
|
//
|
||||||
PROTECTAREA_ENABLED(Boolean.class, "protectarea.enabled"),
|
PROTECTAREA_ENABLED(Boolean.class, "protectarea.enabled"),
|
||||||
PROTECTAREA_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
|
PROTECTAREA_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
|
||||||
|
@ -34,6 +34,9 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private boolean clearChatOptOut = false;
|
private boolean clearChatOptOut = false;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private boolean rideToggle = true;
|
||||||
|
|
||||||
public VPlayer(String name)
|
public VPlayer(String name)
|
||||||
{
|
{
|
||||||
@ -55,6 +58,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
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);
|
||||||
|
rideToggle = cs.getBoolean("rideToggle", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,6 +71,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
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);
|
||||||
|
cs.set("rideToggle", rideToggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getIps()
|
public List<String> getIps()
|
||||||
|
@ -133,6 +133,11 @@ allow:
|
|||||||
minecarts: false
|
minecarts: false
|
||||||
clearonjoin: false
|
clearonjoin: false
|
||||||
tpronjoin: false
|
tpronjoin: false
|
||||||
|
structureblocks: false
|
||||||
|
jigsaws: false
|
||||||
|
grindstones: false
|
||||||
|
jukeboxes: false
|
||||||
|
spawners: false
|
||||||
|
|
||||||
# Blocked commands:
|
# Blocked commands:
|
||||||
#
|
#
|
||||||
@ -264,6 +269,7 @@ disable:
|
|||||||
landmines_enabled: false
|
landmines_enabled: false
|
||||||
mp44_enabled: false
|
mp44_enabled: false
|
||||||
tossmob_enabled: false
|
tossmob_enabled: false
|
||||||
|
4chan_enabled: false
|
||||||
|
|
||||||
# Moblimiter
|
# Moblimiter
|
||||||
moblimiter:
|
moblimiter:
|
||||||
|
Loading…
Reference in New Issue
Block a user