Resolved conflicts with TotalFreedom/Devel Branch

This commit is contained in:
Ryan Wild 2017-07-25 09:53:34 +01:00
commit c4ebbb74c7
13 changed files with 142 additions and 49 deletions

View File

@ -51,10 +51,10 @@ public class ChatManager extends FreedomService
// Strip color from messages
message = ChatColor.stripColor(message);
// Truncate messages that are too long - 100 characters is vanilla client max
if (message.length() > 100)
// Truncate messages that are too long - 256 characters is vanilla client max
if (message.length() > 256)
{
message = message.substring(0, 100);
message = message.substring(0, 256);
FSync.playerMsg(player, "Message was shortened because it was too long to send.");
}

View File

@ -354,7 +354,7 @@ public class FrontDoor extends FreedomService
case 3: // Displays a message
{
FUtil.bcastMsg("TotalFreedom rocks!!", ChatColor.BLUE);
FUtil.bcastMsg("To join this great server, join " + ChatColor.GOLD + "tf.sauc.in", ChatColor.BLUE);
FUtil.bcastMsg("To join this great server, join " + ChatColor.GOLD + "play.totalfreedom.me", ChatColor.BLUE);
break;
}
@ -472,7 +472,7 @@ public class FrontDoor extends FreedomService
sign.setLine(0, ChatColor.BLUE + "TotalFreedom");
sign.setLine(1, ChatColor.DARK_GREEN + "is");
sign.setLine(2, ChatColor.YELLOW + "Awesome!");
sign.setLine(3, ChatColor.DARK_GRAY + "tf.sauc.in");
sign.setLine(3, ChatColor.DARK_GRAY + "play.totalfreedom.me");
sign.update();
}
break;
@ -501,7 +501,7 @@ public class FrontDoor extends FreedomService
ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead\n"
+ ChatColor.DARK_GRAY + "---------\n"
+ ChatColor.BLACK + "TotalFreedom is the original TotalFreedomMod server. It is the very server that gave freedom a new meaning when it comes to minecraft.\n"
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "tf.sauc.in");
+ ChatColor.BLUE + "Join now! " + ChatColor.RED + "play.totalfreedom.me");
bookStack.setItemMeta(book);
for (Player player : Bukkit.getOnlinePlayers())

View File

@ -4,16 +4,16 @@ import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_11_R1.EntityPlayer;
import net.minecraft.server.v1_11_R1.MinecraftServer;
import net.minecraft.server.v1_11_R1.PropertyManager;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_12_R1.PropertyManager;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
public class ServerInterface extends FreedomService
{
public static final String COMPILE_NMS_VERSION = "v1_10_R1";
public static final String COMPILE_NMS_VERSION = "v1_12_R1";
public ServerInterface(TotalFreedomMod plugin)
{

View File

@ -13,6 +13,7 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerKickEvent;
public class Cager extends FreedomService
{
@ -95,6 +96,18 @@ public class Cager extends FreedomService
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerKick(PlayerKickEvent event)
{
FPlayer player = plugin.pl.getPlayer(event.getPlayer());
CageData cage = player.getCageData();
if (cage.isCaged())
{
cage.playerQuit();
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event)
{

View File

@ -0,0 +1,56 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Quickly change your own gamemode to adventure, or define someone's username to change theirs.", usage = "/<command> <-a | [partialname]>", aliases = "gma")
public class Command_adventure extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
if (isConsole())
{
sender.sendMessage("When used from the console, you must define a target player.");
return true;
}
playerSender.setGameMode(GameMode.ADVENTURE);
msg("Gamemode set to adventure.");
return true;
}
if (args[0].equals("-a"))
{
for (Player targetPlayer : server.getOnlinePlayers())
{
targetPlayer.setGameMode(GameMode.ADVENTURE);
}
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
return true;
}
Player player = getPlayer(args[0]);
if (player == null)
{
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
msg("Setting " + player.getName() + " to game mode adventure");
msg(player, sender.getName() + " set your game mode to adventure");
player.setGameMode(GameMode.ADVENTURE);
return true;
}
}

View File

@ -22,7 +22,8 @@ public class Command_disguisetoggle extends FreedomCommand
return true;
}
FUtil.adminAction(sender.getName(), (DisallowedDisguises.disabled ? "Enabling" : "Disabling") + " Disguises", false);
FUtil.adminAction(sender.getName(), (DisallowedDisguises.disabled ? "Enabling" : "Disabling") + " " +
"Disguises", false);
if (plugin.ldb.isDisguisesEnabled())
{
@ -34,7 +35,7 @@ public class Command_disguisetoggle extends FreedomCommand
plugin.ldb.setDisguisesEnabled(true);
}
msg("Enabled " + (DisallowedDisguises.disabled ? "enabled." : "disabled."));
msg("Disguises are now " + (!DisallowedDisguises.disabled ? "enabled." : "disabled."));
return true;
}

View File

@ -21,6 +21,7 @@ public class Command_gtfo extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;

View File

@ -11,20 +11,20 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
@CommandParameters(description = "Shows (and optionally clears) invisisible players", usage = "/<command> [clear]")
public class Command_invis extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean smite = false;
boolean clear = false;
if (args.length >= 1)
{
if (args[0].equalsIgnoreCase("smite"))
if (args[0].equalsIgnoreCase("clear"))
{
FUtil.adminAction(sender.getName(), "Smiting all invisible players", true);
smite = true;
FUtil.adminAction(sender.getName(), "Clearing invisibility for all players", false);
clear = true;
}
else
{
@ -33,17 +33,17 @@ public class Command_invis extends FreedomCommand
}
List<String> players = new ArrayList<>();
int smites = 0;
int clears = 0;
for (Player player : server.getOnlinePlayers())
{
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
{
players.add(player.getName());
if (smite && !plugin.al.isAdmin(player))
if (clear && !plugin.al.isAdmin(player))
{
player.setHealth(0.0);
smites++;
player.removePotionEffect(PotionEffectType.INVISIBILITY);
clears++;
}
}
}
@ -54,9 +54,9 @@ public class Command_invis extends FreedomCommand
return true;
}
if (smite)
if (clear)
{
msg("Smitten " + smites + " players");
msg("Cleared invisibility effect from " + clears + " players");
}
else
{

View File

@ -53,7 +53,7 @@ public class Command_smite extends FreedomCommand
if (reason != null)
{
FUtil.bcastMsg(" Reason: " + reason, ChatColor.RED);
FUtil.bcastMsg(" Reason: " + reason, ChatColor.YELLOW);
}
// Deop
@ -82,7 +82,7 @@ public class Command_smite extends FreedomCommand
if (reason != null)
{
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + reason);
player.sendMessage(ChatColor.RED + "You've been smitten. Reason: " + ChatColor.YELLOW + reason);
}
}
}

View File

@ -1,21 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.GameMode;
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)
@CommandParameters(description = "Quickly change your own gamemode to spectator.", usage = "/<command>", aliases = "gmsp")
public class Command_spectator extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerSender.setGameMode(GameMode.SPECTATOR);
msg("Gamemode set to spectator.");
return true;
}
}

View File

@ -0,0 +1,43 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Unloads chunks not currently in use", usage = "/<command>", aliases = "rc")
public class Command_unloadchunks extends FreedomCommand {
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
FUtil.adminAction(sender.getName(), "Unloading unused chunks", false);
int numChunks = 0;
for (World world : server.getWorlds()) {
numChunks += unloadUnusedChunks(world);
}
FUtil.playerMsg(sender, numChunks + " chunks unloaded.");
return true;
}
private int unloadUnusedChunks(World world) {
int numChunks = 0;
for (Chunk loadedChunk : world.getLoadedChunks()) {
if (!world.isChunkInUse(loadedChunk.getX(), loadedChunk.getZ())) {
if (world.unloadChunk(loadedChunk)) {
numChunks++;
}
}
}
return numChunks;
}
}

View File

@ -36,7 +36,7 @@ public class Module_players extends HTTPDModule
}
// Admins
for (Admin admin : plugin.al.getAllAdmins().values())
for (Admin admin : plugin.al.getActiveAdmins())
{
final String username = admin.getName();

View File

@ -247,7 +247,7 @@ announcer:
- 'MarkByron is the owner of TotalFreedom.'
- 'Server lagging? Check the lag via "/tps"'
- 'You are allowed to record and stream videos on TotalFreedom.'
- 'Player vs player while in creative or god mode it forbidden!'
- 'Player vs player while in creative or god mode is forbidden!'
- 'Spawn killing is forbidden!'
- 'Invisible potions are allowed!'
- 'Serial griefing and trolling will result in a permanent ban!'