More code cleanup, remove bogus method in MVPlayerListener

This commit is contained in:
Eric Stokes 2011-06-30 07:30:55 -06:00
parent f7bdffa365
commit dad4547c21
8 changed files with 30 additions and 50 deletions

View File

@ -24,8 +24,10 @@ public class MVPlayerListener extends PlayerListener {
ps.setRespawnWorld(event.getTo().getWorld()); ps.setRespawnWorld(event.getTo().getWorld());
} }
@Override
public void onPlayerKick(PlayerKickEvent event) { public void onPlayerKick(PlayerKickEvent event) {
event.setCancelled(true); // TODO Auto-generated method stub
super.onPlayerKick(event);
} }
@Override @Override

View File

@ -44,7 +44,7 @@ public class MVPlayerSession {
*/ */
public boolean getTeleportable() { public boolean getTeleportable() {
Long time = (new Date()).getTime(); Long time = (new Date()).getTime();
if ((time - this.teleportLast) > config.getInt("portalcooldown", 5000)) { if ((time - this.teleportLast) > this.config.getInt("portalcooldown", 5000)) {
return true; return true;
} else { } else {
return false; return false;
@ -57,7 +57,7 @@ public class MVPlayerSession {
*/ */
public void message(String msg) { public void message(String msg) {
Long time = (new Date()).getTime(); Long time = (new Date()).getTime();
if ((time - this.messageLast) > config.getInt("messagecooldown", 2000)) { if ((time - this.messageLast) > this.config.getInt("messagecooldown", 2000)) {
this.player.sendMessage(msg); this.player.sendMessage(msg);
this.messageLast = time; this.messageLast = time;
} }

View File

@ -2,37 +2,17 @@ package com.onarandombox.MultiverseCore;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Pig;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Zombie;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
@ -45,7 +25,6 @@ import com.iConomy.iConomy;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.MultiverseCore.command.CommandManager; import com.onarandombox.MultiverseCore.command.CommandManager;
import com.onarandombox.MultiverseCore.command.QueuedCommand;
import com.onarandombox.MultiverseCore.command.commands.*; import com.onarandombox.MultiverseCore.command.commands.*;
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration; import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
import com.onarandombox.utils.DebugLog; import com.onarandombox.utils.DebugLog;

View File

@ -15,7 +15,6 @@ import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.MultiverseCore;

View File

@ -31,16 +31,16 @@ public class QueuedCommand {
} }
public CommandSender getSender() { public CommandSender getSender() {
return sender; return this.sender;
} }
public boolean execute() { public boolean execute() {
timeRequested.add(Calendar.SECOND, 10); this.timeRequested.add(Calendar.SECOND, 10);
if (timeRequested.after(Calendar.getInstance())) { if (this.timeRequested.after(Calendar.getInstance())) {
try { try {
Method method = plugin.getClass().getMethod(name, paramTypes); Method method = this.plugin.getClass().getMethod(this.name, this.paramTypes);
try { try {
method.invoke(plugin, args); method.invoke(this.plugin, this.args);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -65,7 +65,7 @@ public class QueuedCommand {
} }
return true; return true;
} else { } else {
sender.sendMessage("This command has expried. Please type the original command again."); this.sender.sendMessage("This command has expried. Please type the original command again.");
} }
return false; return false;
} }
@ -75,7 +75,7 @@ public class QueuedCommand {
} }
public String getSuccess() { public String getSuccess() {
return success; return this.success;
} }
private void setFail(String fail) { private void setFail(String fail) {
@ -83,6 +83,6 @@ public class QueuedCommand {
} }
public String getFail() { public String getFail() {
return fail; return this.fail;
} }
} }

View File

@ -21,17 +21,17 @@ public class DebugLog {
* @param file The file to log to. * @param file The file to log to.
*/ */
public DebugLog(String logger, String file) { public DebugLog(String logger, String file) {
log = Logger.getLogger(logger); this.log = Logger.getLogger(logger);
try { try {
fh = new FileHandler(file, true); this.fh = new FileHandler(file, true);
log.setUseParentHandlers(false); this.log.setUseParentHandlers(false);
for (Handler handler : log.getHandlers()) { for (Handler handler : this.log.getHandlers()) {
log.removeHandler(handler); this.log.removeHandler(handler);
} }
log.addHandler(fh); this.log.addHandler(this.fh);
log.setLevel(Level.ALL); this.log.setLevel(Level.ALL);
fh.setFormatter(new LogFormatter()); this.fh.setFormatter(new LogFormatter());
} catch (SecurityException e) { } catch (SecurityException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
@ -44,7 +44,7 @@ public class DebugLog {
* @param msg * @param msg
*/ */
public void log(Level level, String msg) { public void log(Level level, String msg) {
log.log(level, msg); this.log.log(level, msg);
} }
private class LogFormatter extends Formatter { private class LogFormatter extends Formatter {
@ -55,7 +55,7 @@ public class DebugLog {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
Throwable ex = record.getThrown(); Throwable ex = record.getThrown();
builder.append(date.format(record.getMillis())); builder.append(this.date.format(record.getMillis()));
builder.append(" ["); builder.append(" [");
builder.append(record.getLevel().getLocalizedName().toUpperCase()); builder.append(record.getLevel().getLocalizedName().toUpperCase());
builder.append("] "); builder.append("] ");
@ -73,6 +73,6 @@ public class DebugLog {
} }
public void close() { public void close() {
fh.close(); this.fh.close();
} }
} }

View File

@ -12,11 +12,11 @@ public class Destination {
} }
public String getName() { public String getName() {
return name; return this.name;
} }
public DestinationType getType() { public DestinationType getType() {
return type; return this.type;
} }
private static Destination getBadDestination() { private static Destination getBadDestination() {

View File

@ -27,7 +27,7 @@ public class UpdateChecker {
int delay = 0; // No Delay, fire the first check instantly. int delay = 0; // No Delay, fire the first check instantly.
int period = 1800; // Delay 30 Minutes int period = 1800; // Delay 30 Minutes
timer.scheduleAtFixedRate(new TimerTask() { this.timer.scheduleAtFixedRate(new TimerTask() {
@Override @Override
public void run() { public void run() {
checkUpdate(); checkUpdate();
@ -37,7 +37,7 @@ public class UpdateChecker {
public void checkUpdate() { public void checkUpdate() {
try { try {
URL url = new URL("http://bukkit.onarandombox.com/multiverse/version.php?n=" + URLEncoder.encode(name, "UTF-8") + "&v=" + cversion); URL url = new URL("http://bukkit.onarandombox.com/multiverse/version.php?n=" + URLEncoder.encode(this.name, "UTF-8") + "&v=" + this.cversion);
URLConnection conn = url.openConnection(); URLConnection conn = url.openConnection();
conn.setReadTimeout(2000); // 2000 = 2 Seconds. conn.setReadTimeout(2000); // 2000 = 2 Seconds.
@ -63,12 +63,12 @@ public class UpdateChecker {
} }
String v1 = normalisedVersion(version); String v1 = normalisedVersion(version);
String v2 = normalisedVersion(cversion); String v2 = normalisedVersion(this.cversion);
int compare = v1.compareTo(v2); int compare = v1.compareTo(v2);
if (compare > 0) { if (compare > 0) {
log.info("[" + name + "]" + " - Update Available (" + version + ")"); log.info("[" + this.name + "]" + " - Update Available (" + version + ")");
} }
rd.close(); rd.close();