mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Batch formatting fix.
This commit is contained in:
parent
44fb26b27f
commit
ba22aedc58
@ -15,7 +15,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Random;
|
||||
@ -26,6 +25,7 @@ import org.bukkit.generator.BlockPopulator;
|
||||
public class CleanroomBlockPopulator extends BlockPopulator
|
||||
{
|
||||
byte[] layerDataValues;
|
||||
|
||||
protected CleanroomBlockPopulator(byte[] layerDataValues)
|
||||
{
|
||||
this.layerDataValues = layerDataValues;
|
||||
@ -38,10 +38,13 @@ public class CleanroomBlockPopulator extends BlockPopulator
|
||||
int x = chunk.getX() << 4;
|
||||
int z = chunk.getZ() << 4;
|
||||
|
||||
for (int y = 0; y < layerDataValues.length ; y++)
|
||||
for (int y = 0; y < layerDataValues.length; y++)
|
||||
{
|
||||
byte dataValue = layerDataValues[y];
|
||||
if (dataValue == 0) continue;
|
||||
if (dataValue == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (int xx = 0; xx < 16; xx++)
|
||||
{
|
||||
for (int zz = 0; zz < 16; zz++)
|
||||
|
@ -15,7 +15,6 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
@ -55,16 +54,20 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
if ((id.length() > 0) && (id.charAt(0) == '.')) // Is the first character a '.'? If so, skip bedrock generation.
|
||||
{
|
||||
id = id.substring(1); // Skip bedrock then and remove the .
|
||||
} else // Guess not, bedrock at layer0 it is then.
|
||||
}
|
||||
else // Guess not, bedrock at layer0 it is then.
|
||||
{
|
||||
layer[y++] = (short)Material.BEDROCK.getId();
|
||||
layer[y++] = (short) Material.BEDROCK.getId();
|
||||
}
|
||||
|
||||
if (id.length() > 0)
|
||||
{
|
||||
String tokens[] = id.split("[,]");
|
||||
|
||||
if ((tokens.length % 2) != 0) throw new Exception();
|
||||
if ((tokens.length % 2) != 0)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
for (int i = 0; i < tokens.length; i += 2)
|
||||
{
|
||||
@ -83,7 +86,8 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
// Lets try to read the data value
|
||||
dataValue = Byte.parseByte(materialTokens[1]);
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warning("[CleanroomGenerator] Invalid Data Value '" + materialTokens[1] + "'. Defaulting to 0.");
|
||||
dataValue = 0;
|
||||
@ -96,7 +100,8 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
// Mabe it's an integer?
|
||||
mat = Material.getMaterial(Integer.parseInt(materialTokens[0]));
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Well, I guess it wasn't an integer after all... Awkward...
|
||||
}
|
||||
@ -127,7 +132,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
}
|
||||
}
|
||||
|
||||
Arrays.fill(layer, y, y + height, (short)mat.getId());
|
||||
Arrays.fill(layer, y, y + height, (short) mat.getId());
|
||||
if (dataValue != 0)
|
||||
{
|
||||
if (layerDataValues == null)
|
||||
@ -153,21 +158,23 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
arraycopy(layerDataValues, 0, newLayerDataValues, 0, y);
|
||||
layerDataValues = newLayerDataValues;
|
||||
}
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.severe("[CleanroomGenerator] Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e.toString());
|
||||
e.printStackTrace();
|
||||
layerDataValues = null;
|
||||
layer = new short[65];
|
||||
layer[0] = (short)Material.BEDROCK.getId();
|
||||
Arrays.fill(layer, 1, 65, (short)Material.STONE.getId());
|
||||
layer[0] = (short) Material.BEDROCK.getId();
|
||||
Arrays.fill(layer, 1, 65, (short) Material.STONE.getId());
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
layerDataValues = null;
|
||||
layer = new short[65];
|
||||
layer[0] = (short)Material.BEDROCK.getId();
|
||||
Arrays.fill(layer, 1, 65, (short)Material.STONE.getId());
|
||||
layer[0] = (short) Material.BEDROCK.getId();
|
||||
Arrays.fill(layer, 1, 65, (short) Material.STONE.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,8 +207,9 @@ public class CleanroomChunkGenerator extends ChunkGenerator
|
||||
{
|
||||
if (layerDataValues != null)
|
||||
{
|
||||
return Arrays.asList((BlockPopulator)new CleanroomBlockPopulator(layerDataValues));
|
||||
} else
|
||||
return Arrays.asList((BlockPopulator) new CleanroomBlockPopulator(layerDataValues));
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is the default, but just in case default populators change to stock minecraft populators by default...
|
||||
return new ArrayList<BlockPopulator>();
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
|
||||
public class Command_invis extends TFM_Command {
|
||||
public class Command_invis extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -35,7 +35,8 @@ public class Command_invis extends TFM_Command {
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
|
||||
if (p.hasPotionEffect(PotionEffectType.INVISIBILITY))
|
||||
{
|
||||
players.add(p.getName());
|
||||
if (smite && !TFM_SuperadminList.isUserSuperadmin(p))
|
||||
{
|
||||
@ -45,7 +46,8 @@ public class Command_invis extends TFM_Command {
|
||||
}
|
||||
}
|
||||
|
||||
if (players.isEmpty()) {
|
||||
if (players.isEmpty())
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "There are no invisible players");
|
||||
return true;
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Shows the uptime of all minecraft services.", usage = "/<command>")
|
||||
public class Command_minecraft extends TFM_Command {
|
||||
|
||||
public class Command_minecraft extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -21,5 +21,4 @@ public class Command_minecraft extends TFM_Command {
|
||||
playerMsg("Version " + TFM_ServiceChecker.version + ", Last Checked: " + TFM_ServiceChecker.last_updated, ChatColor.BLUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,11 +8,10 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH, block_host_console = true)
|
||||
@CommandParameters(description = "Issues a rollback on a player", usage = "/<command> <[partialname] | purge [partialname] | purgeall>", aliases = "rb")
|
||||
public class Command_rollback extends TFM_Command {
|
||||
|
||||
public class Command_rollback extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -48,7 +47,9 @@ public class Command_rollback extends TFM_Command {
|
||||
if (!TFM_RollbackManager.canRollback(p.getName()))
|
||||
{
|
||||
playerMsg("No rollback data found for that player", ChatColor.RED);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Purged " + TFM_RollbackManager.purgeEntries(p.getName()) + " entries.");
|
||||
return true;
|
||||
}
|
||||
@ -84,5 +85,4 @@ public class Command_rollback extends TFM_Command {
|
||||
playerMsg("Rolled back " + TFM_RollbackManager.rollback(p) + " blocks");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Show misc. server info.", usage = "/<command>")
|
||||
public class Command_status extends TFM_Command
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> <partialname>", aliases = "nope")
|
||||
public class Command_tban extends TFM_Command {
|
||||
|
||||
public class Command_tban extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -37,5 +37,4 @@ public class Command_tban extends TFM_Command {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -260,7 +260,6 @@ public class TFM_BlockListener implements Listener
|
||||
{
|
||||
TFM_RollbackManager.blockUpdate(event.getPlayer(), event.getBlock());
|
||||
}
|
||||
|
||||
// @EventHandler(priority = EventPriority.NORMAL)
|
||||
// public void onCommandBlockChangeEvent(CommandBlockChangeEvent event)
|
||||
// {
|
||||
|
@ -4,10 +4,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
|
||||
public class TFM_RollbackEntry
|
||||
{
|
||||
|
||||
private Location location;
|
||||
private Material material;
|
||||
private byte data;
|
||||
|
@ -13,7 +13,7 @@ public class TFM_RollbackManager
|
||||
|
||||
public static void blockUpdate(OfflinePlayer player, Block block)
|
||||
{
|
||||
List <TFM_RollbackEntry> e;
|
||||
List<TFM_RollbackEntry> e;
|
||||
if (entries.containsKey(player.getName()))
|
||||
{
|
||||
e = entries.get(player.getName());
|
||||
@ -28,7 +28,7 @@ public class TFM_RollbackManager
|
||||
|
||||
public static void blockUpdate(OfflinePlayer player, TFM_RollbackEntry entry)
|
||||
{
|
||||
List <TFM_RollbackEntry> e;
|
||||
List<TFM_RollbackEntry> e;
|
||||
if (entries.containsKey(player.getName()))
|
||||
{
|
||||
e = entries.get(player.getName());
|
||||
@ -83,4 +83,4 @@ public class TFM_RollbackManager
|
||||
entries.remove(player);
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,23 +14,41 @@ import org.bukkit.ChatColor;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
|
||||
public class TFM_ServiceChecker {
|
||||
public class TFM_ServiceChecker
|
||||
{
|
||||
private static final Map<String, String[]> SERVICE_MAP = new HashMap<String, String[]>();
|
||||
public static String check_url = "http://xpaw.ru/mcstatus/status.json";
|
||||
public static String version = "1.0";
|
||||
public static String last_updated = ""; // On xpaw.ru
|
||||
|
||||
static
|
||||
{
|
||||
// <"up", "down", "problem">, <"Online", "Quite Slow", "Error 505", etc>, <String (Uptime percentage)>
|
||||
SERVICE_MAP.put("website", new String[]{"up", "Online", "100.00"});
|
||||
SERVICE_MAP.put("session", new String[]{"up", "Online", "100.00"});
|
||||
SERVICE_MAP.put("login", new String[]{"up", "Online", "100.00"});
|
||||
SERVICE_MAP.put("account", new String[]{"up", "Online", "100.00"});
|
||||
SERVICE_MAP.put("skins", new String[]{"up", "Online", "100.00"});
|
||||
SERVICE_MAP.put("realms", new String[]{"up", "Online", "100.00"});
|
||||
SERVICE_MAP.put("website", new String[]
|
||||
{
|
||||
"up", "Online", "100.00"
|
||||
});
|
||||
SERVICE_MAP.put("session", new String[]
|
||||
{
|
||||
"up", "Online", "100.00"
|
||||
});
|
||||
SERVICE_MAP.put("login", new String[]
|
||||
{
|
||||
"up", "Online", "100.00"
|
||||
});
|
||||
SERVICE_MAP.put("account", new String[]
|
||||
{
|
||||
"up", "Online", "100.00"
|
||||
});
|
||||
SERVICE_MAP.put("skins", new String[]
|
||||
{
|
||||
"up", "Online", "100.00"
|
||||
});
|
||||
SERVICE_MAP.put("realms", new String[]
|
||||
{
|
||||
"up", "Online", "100.00"
|
||||
});
|
||||
}
|
||||
|
||||
public static Runnable checker = new Runnable()
|
||||
{
|
||||
@Override
|
||||
@ -77,13 +95,15 @@ public class TFM_ServiceChecker {
|
||||
last_updated = (String) service_json.get("last_updated");
|
||||
|
||||
JSONObject services = (JSONObject) service_json.get("report");
|
||||
for (String service: SERVICE_MAP.keySet())
|
||||
for (String service : SERVICE_MAP.keySet())
|
||||
{
|
||||
JSONObject service_info = (JSONObject) services.get(service);
|
||||
SERVICE_MAP.put(service, new String[]{
|
||||
SERVICE_MAP.put(service, new String[]
|
||||
{
|
||||
(String) service_info.get("status"),
|
||||
(String) service_info.get("title"),
|
||||
(String) service_info.get("uptime")});
|
||||
(String) service_info.get("uptime")
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -97,13 +117,13 @@ public class TFM_ServiceChecker {
|
||||
public static String getFormattedStatus(String service_name)
|
||||
{
|
||||
String[] service = SERVICE_MAP.get(service_name);
|
||||
String status = ("up".equals(service[0]) ? ChatColor.GREEN :
|
||||
("down".equals(service[0]) ? ChatColor.RED : ChatColor.GOLD)).toString();
|
||||
String status = ("up".equals(service[0]) ? ChatColor.GREEN
|
||||
: ("down".equals(service[0]) ? ChatColor.RED : ChatColor.GOLD)).toString();
|
||||
|
||||
status += service[1] + ChatColor.GRAY + " (";
|
||||
|
||||
status += (Float.parseFloat(service[2]) >= 96.0 ? ChatColor.GREEN :
|
||||
(Float.parseFloat(service[2]) > 90.0 ? ChatColor.GOLD : ChatColor.RED));
|
||||
status += (Float.parseFloat(service[2]) >= 96.0 ? ChatColor.GREEN
|
||||
: (Float.parseFloat(service[2]) > 90.0 ? ChatColor.GOLD : ChatColor.RED));
|
||||
|
||||
status += service[2] + "%" + ChatColor.GRAY + ")";
|
||||
|
||||
@ -119,23 +139,22 @@ public class TFM_ServiceChecker {
|
||||
}
|
||||
return statuses;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* // Mojang status
|
||||
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
|
||||
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
|
||||
|
||||
static
|
||||
{
|
||||
static
|
||||
{
|
||||
SERVICE_MAP.put("minecraft.net", "Minecraft.net");
|
||||
SERVICE_MAP.put("login.minecraft.net", "Minecraft Logins");
|
||||
SERVICE_MAP.put("session.minecraft.net", "Minecraft Multiplayer Sessions");
|
||||
SERVICE_MAP.put("account.mojang.com", "Mojang Accounts Website");
|
||||
SERVICE_MAP.put("auth.mojang.com", "Mojang Accounts Login");
|
||||
SERVICE_MAP.put("skins.minecraft.net", "Minecraft Skins");
|
||||
}
|
||||
server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
||||
{
|
||||
}
|
||||
server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void run()
|
||||
@ -185,5 +204,5 @@ server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
@ -978,7 +978,8 @@ public class TFM_Util
|
||||
public static String getPrefix(CommandSender sender, boolean senderIsConsole)
|
||||
{
|
||||
String prefix;
|
||||
if (senderIsConsole) {
|
||||
if (senderIsConsole)
|
||||
{
|
||||
prefix = ChatColor.BLUE + "(Console)";
|
||||
}
|
||||
else
|
||||
@ -986,7 +987,8 @@ public class TFM_Util
|
||||
if (TFM_SuperadminList.isSeniorAdmin(sender))
|
||||
{
|
||||
prefix = ChatColor.LIGHT_PURPLE + "(SrA)";
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
prefix = ChatColor.GOLD + "(SA)";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user