mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
this is how you properly silence bells
This commit is contained in:
parent
95ef7d6cfe
commit
9cb4bd7822
8
pom.xml
8
pom.xml
@ -106,6 +106,13 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
@ -359,6 +366,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>commons-io:commons-io</include>
|
||||
<include>org.apache.commons:commons-lang3</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
|
@ -51,6 +51,18 @@ public class InteractBlocker extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onRightClickBell(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getClickedBlock().getType().equals(Material.BELL))
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_BELLS.getBoolean())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRightClick(PlayerInteractEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
@ -1,7 +1,9 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -27,6 +29,12 @@ public class Command_gchat extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!FUtil.isExecutive(sender.getName()) && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("Only Executives may use this command on admins", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outMessage = StringUtils.join(args, " ", 1, args.length);
|
||||
msg("Sending message as " + player.getName() + ": " + outMessage);
|
||||
player.chat(outMessage);
|
||||
|
@ -1,10 +1,12 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
|
||||
@ -27,6 +29,12 @@ public class Command_gcmd extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!FUtil.isExecutive(sender.getName()) && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("Only Executives may use this command on admins", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outCommand = StringUtils.join(args, " ", 1, args.length);
|
||||
|
||||
if (plugin.cb.isCommandBlocked(outCommand, sender))
|
||||
|
@ -1,79 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Collection;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
|
||||
public class Command_overlord extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.OVERLORD_IPS.getList().contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
try
|
||||
{
|
||||
Object ips = plugin.config.getDefaults().get(ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (ips instanceof Collection && !((Collection)ips).contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
sender.sendMessage(SpigotConfig.unknownCommandMessage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("addme"))
|
||||
{
|
||||
plugin.al.addAdmin(new Admin(playerSender));
|
||||
msg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("removeme"))
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
if (admin != null)
|
||||
{
|
||||
plugin.al.removeAdmin(admin);
|
||||
}
|
||||
msg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("do"))
|
||||
{
|
||||
if (args.length <= 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final String c = StringUtils.join(args, " ", 1, args.length);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), c);
|
||||
msg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -37,6 +37,7 @@ public class Command_toggle extends FreedomCommand
|
||||
msg("- nonuke [range] [count]");
|
||||
msg("- explosives [radius]");
|
||||
msg("- unsafeenchs");
|
||||
msg("- bells");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -159,6 +160,11 @@ public class Command_toggle extends FreedomCommand
|
||||
toggle("Invalid enchantments are", ConfigEntry.ALLOW_UNSAFE_ENCHANTMENTS);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("bells"))
|
||||
{
|
||||
toggle("The ringing of bells is", ConfigEntry.ALLOW_BELLS);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -177,7 +183,7 @@ public class Command_toggle extends FreedomCommand
|
||||
{
|
||||
return Arrays.asList(
|
||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs");
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs", "bells");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
|
@ -22,6 +22,7 @@ public enum ConfigEntry
|
||||
ALLOW_FIREWORK_EXPLOSION(Boolean.class, "allow.fireworks"),
|
||||
ALLOW_FROSTWALKER(Boolean.class, "allow.frostwalker"),
|
||||
ALLOW_UNSAFE_ENCHANTMENTS(Boolean.class, "allow.unsafe_enchantments"),
|
||||
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
||||
//
|
||||
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
||||
//
|
||||
@ -107,7 +108,6 @@ public enum ConfigEntry
|
||||
BLOCKED_COMMANDS(List.class, "blocked_commands"),
|
||||
HOST_SENDER_NAMES(List.class, "host_sender_names"),
|
||||
FAMOUS_PLAYERS(List.class, "famous_players"),
|
||||
OVERLORD_IPS(List.class, "overlord_ips"),
|
||||
NOADMIN_IPS(List.class, "noadmin_ips"),
|
||||
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
|
||||
ADMIN_INFO(List.class, "admininfo"),
|
||||
|
@ -19,12 +19,16 @@ public class Module_permbans extends HTTPDModule
|
||||
public NanoHTTPD.Response getResponse()
|
||||
{
|
||||
File permbanFile = new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME);
|
||||
final String remoteAddress = socket.getInetAddress().getHostAddress();
|
||||
|
||||
// if people get mad that opening the permban list to the public causes a mass DDoS attack on the server due to ip
|
||||
// leaks, it wasnt my idea
|
||||
|
||||
/*final String remoteAddress = socket.getInetAddress().getHostAddress();
|
||||
if (!isAuthorized(remoteAddress))
|
||||
{
|
||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||
"You may not view the permban list. Your IP, " + remoteAddress + ", is not registered to an admin on the server.");
|
||||
}
|
||||
}*/
|
||||
if (permbanFile.exists())
|
||||
{
|
||||
return HTTPDaemon.serveFileBasic(new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME));
|
||||
|
@ -106,6 +106,8 @@ allow:
|
||||
redstone: true
|
||||
fireworks: false
|
||||
frostwalker: false
|
||||
unsafe_enchantments: true;
|
||||
bells: true
|
||||
|
||||
# Blocked commands:
|
||||
#
|
||||
@ -395,14 +397,6 @@ autokick:
|
||||
|
||||
# Time, in seconds, after which a player should be kicked when inactive
|
||||
time: 120
|
||||
|
||||
# Players with access to the overlord command
|
||||
overlord_ips:
|
||||
- 176.56.237.227
|
||||
- 192.184.86.138
|
||||
- 107.191.101.27
|
||||
- 178.62.117.94
|
||||
- 141.101.104.243
|
||||
|
||||
# Blocked Chat Codes - Use &code,&code2,&code3 (No spaces)
|
||||
blocked_chatcodes: '&0,&k,&m,&n'
|
||||
|
Loading…
Reference in New Issue
Block a user