mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-29 04:57:37 +00:00
i hate video ass smash
This commit is contained in:
parent
a7de5edfcb
commit
1181de8ed4
@ -10,6 +10,7 @@ import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -129,7 +130,7 @@ public class ChatManager extends FreedomService
|
||||
event.setFormat(format);
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.util.Objects;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||
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.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MovementValidator extends FreedomService
|
||||
{
|
||||
|
||||
public static final int MAX_XYZ_COORD = 29999998;
|
||||
public static final int MAX_DISTANCE_TRAVELED = 100;
|
||||
|
||||
public MovementValidator(TotalFreedomMod plugin)
|
||||
{
|
||||
@ -53,7 +56,13 @@ public class MovementValidator extends FreedomService
|
||||
public void onPlayerMove(PlayerMoveEvent event)
|
||||
{
|
||||
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
|
||||
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)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
@ -33,31 +32,31 @@ public class ServerPing extends FreedomService
|
||||
|
||||
if (plugin.bm.isIpBanned(ip))
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "You are banned.");
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_BAN_MOTD.getString()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server is closed.");
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_ADMINMODE_MOTD.getString()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (LoginProcess.isLockdownEnabled())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server is in lock-down.");
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_LOCKDOWN_MOTD.getString()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.hasWhitelist())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Whitelist enabled.");
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_WHITELIST_MOTD.getString()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getMaxPlayers())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server is full.");
|
||||
event.setMotd(FUtil.colorize(ConfigEntry.SERVER_FULL_MOTD.getString()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,9 @@ import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
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.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -61,6 +61,12 @@ public enum ConfigEntry
|
||||
SERVER_TABLIST_HEADER(String.class, "server.tablist_header"),
|
||||
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_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"),
|
||||
DISCORD_CHAT_CHANNEL_ID(String.class, "discord.chat_channel_id"),
|
||||
|
@ -17,6 +17,14 @@ server:
|
||||
# Every word in the MOTD will be a different color unless prefixed by a color code
|
||||
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
|
||||
login_title:
|
||||
title: '&7Welcome to &6TotalFreedom&7!'
|
||||
|
Loading…
Reference in New Issue
Block a user