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());
}
@Override
public void onPlayerKick(PlayerKickEvent event) {
event.setCancelled(true);
// TODO Auto-generated method stub
super.onPlayerKick(event);
}
@Override

View File

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

View File

@ -2,37 +2,17 @@ package com.onarandombox.MultiverseCore;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
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.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.Priority;
import org.bukkit.generator.ChunkGenerator;
@ -45,7 +25,6 @@ import com.iConomy.iConomy;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.onarandombox.MultiverseCore.command.CommandManager;
import com.onarandombox.MultiverseCore.command.QueuedCommand;
import com.onarandombox.MultiverseCore.command.commands.*;
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
import com.onarandombox.utils.DebugLog;

View File

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

View File

@ -31,16 +31,16 @@ public class QueuedCommand {
}
public CommandSender getSender() {
return sender;
return this.sender;
}
public boolean execute() {
timeRequested.add(Calendar.SECOND, 10);
if (timeRequested.after(Calendar.getInstance())) {
this.timeRequested.add(Calendar.SECOND, 10);
if (this.timeRequested.after(Calendar.getInstance())) {
try {
Method method = plugin.getClass().getMethod(name, paramTypes);
Method method = this.plugin.getClass().getMethod(this.name, this.paramTypes);
try {
method.invoke(plugin, args);
method.invoke(this.plugin, this.args);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -65,7 +65,7 @@ public class QueuedCommand {
}
return true;
} 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;
}
@ -75,7 +75,7 @@ public class QueuedCommand {
}
public String getSuccess() {
return success;
return this.success;
}
private void setFail(String fail) {
@ -83,6 +83,6 @@ public class QueuedCommand {
}
public String getFail() {
return fail;
return this.fail;
}
}

View File

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

View File

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

View File

@ -27,7 +27,7 @@ public class UpdateChecker {
int delay = 0; // No Delay, fire the first check instantly.
int period = 1800; // Delay 30 Minutes
timer.scheduleAtFixedRate(new TimerTask() {
this.timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
checkUpdate();
@ -37,7 +37,7 @@ public class UpdateChecker {
public void checkUpdate() {
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();
conn.setReadTimeout(2000); // 2000 = 2 Seconds.
@ -63,12 +63,12 @@ public class UpdateChecker {
}
String v1 = normalisedVersion(version);
String v2 = normalisedVersion(cversion);
String v2 = normalisedVersion(this.cversion);
int compare = v1.compareTo(v2);
if (compare > 0) {
log.info("[" + name + "]" + " - Update Available (" + version + ")");
log.info("[" + this.name + "]" + " - Update Available (" + version + ")");
}
rd.close();