mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
A few little fixes.
Make /cake give the cake achievement. Fix /lockup. Colorful MOTD, more MOTD options.
This commit is contained in:
parent
15fbd0e1f3
commit
0dca359e4c
@ -1,5 +1,5 @@
|
||||
#Wed, 03 Jul 2013 16:10:19 -0400
|
||||
#Wed, 03 Jul 2013 22:54:08 -0400
|
||||
|
||||
program.VERSION=2.20
|
||||
program.BUILDNUM=247
|
||||
program.BUILDDATE=07/03/2013 04\:10 PM
|
||||
program.BUILDNUM=259
|
||||
program.BUILDDATE=07/03/2013 10\:54 PM
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Wed Jul 03 16:10:19 EDT 2013
|
||||
build.number=248
|
||||
#Wed Jul 03 22:54:08 EDT 2013
|
||||
build.number=260
|
||||
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
@ -31,6 +32,10 @@ public class Command_cake extends TFM_Command
|
||||
{
|
||||
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
||||
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
||||
p.awardAchievement(Achievement.MINE_WOOD);
|
||||
p.awardAchievement(Achievement.BUILD_WORKBENCH);
|
||||
p.awardAchievement(Achievement.BUILD_HOE);
|
||||
p.awardAchievement(Achievement.BAKE_CAKE);
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(output.toString());
|
||||
|
@ -1,9 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -115,19 +113,12 @@ public class Command_lockup extends TFM_Command
|
||||
|
||||
playerdata.setLockupScheduleID(server.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable()
|
||||
{
|
||||
private Random random = new Random();
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (p.isOnline())
|
||||
{
|
||||
p.openWorkbench(null, true);
|
||||
|
||||
Location l = p.getLocation().clone();
|
||||
l.setPitch(random.nextFloat() * 360.0f);
|
||||
l.setYaw(random.nextFloat() * 360.0f);
|
||||
p.teleport(l);
|
||||
p.openInventory(p.getInventory());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.*;
|
||||
import net.minecraft.server.v1_6_R1.MinecraftServer;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -756,19 +757,29 @@ public class TFM_PlayerListener implements Listener
|
||||
TFM_ServerInterface.handlePlayerLogin(event);
|
||||
}
|
||||
|
||||
@EventHandler()
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onServerPing(ServerListPingEvent event)
|
||||
{
|
||||
// Colorize :)
|
||||
event.setMotd(ChatColor.translateAlternateColorCodes('&', event.getMotd()));
|
||||
//event.setMotd(ChatColor.translateAlternateColorCodes('&', event.getMotd()));
|
||||
|
||||
event.setMotd(TFM_Util.randomChatColor() + "Total" + TFM_Util.randomChatColor() + "Freedom " + ChatColor.DARK_GRAY
|
||||
+ "-" + TFM_Util.randomChatColor() + " Bukkit v" + String.valueOf(MinecraftServer.getServer().getVersion()));
|
||||
|
||||
if (TFM_ServerInterface.isIPBanned(event.getAddress().getHostAddress()))
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "You are banned!");
|
||||
event.setMotd(ChatColor.RED + "You are banned.");
|
||||
}
|
||||
if (TotalFreedomMod.adminOnlyMode)
|
||||
else if (TotalFreedomMod.adminOnlyMode)
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server in AdminMode!");
|
||||
event.setMotd(ChatColor.RED + "Server is closed.");
|
||||
}
|
||||
else if (Bukkit.hasWhitelist())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Whitelist enabled.");
|
||||
}
|
||||
else if (Bukkit.getOnlinePlayers().length >= Bukkit.getMaxPlayers())
|
||||
{
|
||||
event.setMotd(ChatColor.RED + "Server is full.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1035,4 +1035,23 @@ public class TFM_Util
|
||||
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final List<ChatColor> COLOR_POOL = Arrays.asList(
|
||||
ChatColor.DARK_BLUE,
|
||||
ChatColor.DARK_GREEN,
|
||||
ChatColor.DARK_AQUA,
|
||||
ChatColor.DARK_RED,
|
||||
ChatColor.DARK_PURPLE,
|
||||
ChatColor.GOLD,
|
||||
ChatColor.BLUE,
|
||||
ChatColor.GREEN,
|
||||
ChatColor.AQUA,
|
||||
ChatColor.RED,
|
||||
ChatColor.LIGHT_PURPLE,
|
||||
ChatColor.YELLOW);
|
||||
private static final Random RANDOM = new Random();
|
||||
public static ChatColor randomChatColor()
|
||||
{
|
||||
return COLOR_POOL.get(RANDOM.nextInt(COLOR_POOL.size()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user