i hate video ass smash

This commit is contained in:
Super_ 2020-01-04 18:35:41 -05:00
parent a7de5edfcb
commit 1181de8ed4
6 changed files with 34 additions and 8 deletions

View File

@ -10,6 +10,7 @@ import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync; import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.admin.Admin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -129,7 +130,7 @@ public class ChatManager extends FreedomService
event.setFormat(format); event.setFormat(format);
// Send to discord // Send to discord
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist())
{ {
plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message)); plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message));
} }

View File

@ -8,6 +8,7 @@ import java.util.Objects;
import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagList; import net.minecraft.server.v1_15_R1.NBTTagList;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,11 +19,13 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
public class MovementValidator extends FreedomService public class MovementValidator extends FreedomService
{ {
public static final int MAX_XYZ_COORD = 29999998; public static final int MAX_XYZ_COORD = 29999998;
public static final int MAX_DISTANCE_TRAVELED = 100;
public MovementValidator(TotalFreedomMod plugin) public MovementValidator(TotalFreedomMod plugin)
{ {
@ -53,7 +56,13 @@ public class MovementValidator extends FreedomService
public void onPlayerMove(PlayerMoveEvent event) public void onPlayerMove(PlayerMoveEvent event)
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
Location from = event.getFrom();
Location to = event.getTo();
if (to.getX() >= from.getX() + MAX_DISTANCE_TRAVELED || to.getY() >= from.getY() + MAX_DISTANCE_TRAVELED || to.getZ() >= from.getZ() + MAX_DISTANCE_TRAVELED)
{
event.setCancelled(true);
player.kickPlayer(ChatColor.RED + "You were moving too quickly!");
}
// Check absolute value to account for negatives // Check absolute value to account for negatives
if (Math.abs(event.getTo().getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD) if (Math.abs(event.getTo().getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD)
{ {

View File

@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
@ -33,31 +32,31 @@ public class ServerPing extends FreedomService
if (plugin.bm.isIpBanned(ip)) if (plugin.bm.isIpBanned(ip))
{ {
event.setMotd(ChatColor.RED + "You are banned."); event.setMotd(FUtil.colorize(ConfigEntry.SERVER_BAN_MOTD.getString()));
return; return;
} }
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
{ {
event.setMotd(ChatColor.RED + "Server is closed."); event.setMotd(FUtil.colorize(ConfigEntry.SERVER_ADMINMODE_MOTD.getString()));
return; return;
} }
if (LoginProcess.isLockdownEnabled()) if (LoginProcess.isLockdownEnabled())
{ {
event.setMotd(ChatColor.RED + "Server is in lock-down."); event.setMotd(FUtil.colorize(ConfigEntry.SERVER_LOCKDOWN_MOTD.getString()));
return; return;
} }
if (Bukkit.hasWhitelist()) if (Bukkit.hasWhitelist())
{ {
event.setMotd(ChatColor.RED + "Whitelist enabled."); event.setMotd(FUtil.colorize(ConfigEntry.SERVER_WHITELIST_MOTD.getString()));
return; return;
} }
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getMaxPlayers()) if (Bukkit.getOnlinePlayers().size() >= Bukkit.getMaxPlayers())
{ {
event.setMotd(ChatColor.RED + "Server is full."); event.setMotd(FUtil.colorize(ConfigEntry.SERVER_FULL_MOTD.getString()));
return; return;
} }

View File

@ -7,6 +7,9 @@ import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.block.ShulkerBox;
import org.bukkit.block.Skull; import org.bukkit.block.Skull;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;

View File

@ -61,6 +61,12 @@ public enum ConfigEntry
SERVER_TABLIST_HEADER(String.class, "server.tablist_header"), SERVER_TABLIST_HEADER(String.class, "server.tablist_header"),
SERVER_TABLIST_FOOTER(String.class, "server.tablist_footer"), SERVER_TABLIST_FOOTER(String.class, "server.tablist_footer"),
// //
SERVER_BAN_MOTD(String.class, "server.motds.ban"),
SERVER_ADMINMODE_MOTD(String.class, "server.motds.adminmode"),
SERVER_LOCKDOWN_MOTD(String.class, "server.motds.lockdown"),
SERVER_WHITELIST_MOTD(String.class, "server.motds.whitelist"),
SERVER_FULL_MOTD(String.class, "server.motds.full"),
//
DISCORD_TOKEN(String.class, "discord.token"), DISCORD_TOKEN(String.class, "discord.token"),
DISCORD_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"), DISCORD_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"),
DISCORD_CHAT_CHANNEL_ID(String.class, "discord.chat_channel_id"), DISCORD_CHAT_CHANNEL_ID(String.class, "discord.chat_channel_id"),

View File

@ -17,6 +17,14 @@ server:
# Every word in the MOTD will be a different color unless prefixed by a color code # Every word in the MOTD will be a different color unless prefixed by a color code
colorful_motd: true colorful_motd: true
# MOTD Modification
motds:
ban: '&cYou are banned.'
adminmode: '&cServer is closed.'
lockdown: '&cServer is in lock-down.'
whitelist: '&cWhitelist enabled.'
full: '&cServer is full.'
# Shown on join as a title # Shown on join as a title
login_title: login_title:
title: '&7Welcome to &6TotalFreedom&7!' title: '&7Welcome to &6TotalFreedom&7!'