3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

Removed LocalCommandSender again. Didn't lead to anything.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-15 11:27:22 +01:00
Ursprung af6455ea6b
Commit 88dd420d1f
3 geänderte Dateien mit 108 neuen und 130 gelöschten Zeilen

Datei anzeigen

@ -1,121 +0,0 @@
package com.sk89q.worldedit;
import java.io.File;
public abstract class LocalCommandSender {
/**
* Server.
*/
protected ServerInterface server;
public LocalCommandSender(ServerInterface server) {
this.server = server;
}
/**
* Get the name of the player.
*
* @return String
*/
public abstract String getName();
/**
* Print a message.
*
* @param msg
*/
public abstract void printRaw(String msg);
/**
* Print a WorldEdit message.
*
* @param msg
*/
public abstract void printDebug(String msg);
/**
* Print a WorldEdit message.
*
* @param msg
*/
public abstract void print(String msg);
/**
* Print a WorldEdit error.
*
* @param msg
*/
public abstract void printError(String msg);
/**
* Get a player's list of groups.
*
* @return
*/
public abstract String[] getGroups();
/**
* Checks if a player has permission.
*
* @param perm
* @return
*/
public abstract boolean hasPermission(String perm);
public void checkPermission(String permission) throws WorldEditPermissionException {
if (!hasPermission(permission)) {
throw new WorldEditPermissionException();
}
}
/**
* Open a file open dialog.
*
* @param extensions null to allow all
* @return
*/
public File openFileOpenDialog(String[] extensions) {
printError("File dialogs are not supported in your environment.");
return null;
}
/**
* Open a file save dialog.
*
* @param extensions null to allow all
* @return
*/
public File openFileSaveDialog(String[] extensions) {
printError("File dialogs are not supported in your environment.");
return null;
}
/**
* Returns true if equal.
*
* @param other
* @return whether the other object is equivalent
*/
@Override
public boolean equals(Object other) {
if (!(other instanceof LocalCommandSender)) {
return false;
}
LocalCommandSender other2 = (LocalCommandSender) other;
return other2.getName().equals(getName());
}
/**
* Gets the hash code.
*
* @return hash code
*/
@Override
public int hashCode() {
return getName().hashCode();
}
public LocalPlayer asPlayer() throws PlayerNeededException {
throw new PlayerNeededException();
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import java.io.File;
import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
@ -30,14 +31,19 @@ import com.sk89q.worldedit.util.TargetBlock;
* *
* @author sk89q * @author sk89q
*/ */
public abstract class LocalPlayer extends LocalCommandSender { public abstract class LocalPlayer {
/**
* Server.
*/
protected ServerInterface server;
/** /**
* Construct the object. * Construct the object.
* *
* @param server * @param server
*/ */
protected LocalPlayer(ServerInterface server) { protected LocalPlayer(ServerInterface server) {
super(server); this.server = server;
} }
/** /**
@ -406,6 +412,13 @@ public abstract class LocalPlayer extends LocalCommandSender {
*/ */
public abstract int getItemInHand(); public abstract int getItemInHand();
/**
* Get the name of the player.
*
* @return String
*/
public abstract String getName();
/** /**
* Get the player's position. * Get the player's position.
* *
@ -501,6 +514,34 @@ public abstract class LocalPlayer extends LocalCommandSender {
return false; return false;
} }
/**
* Print a message.
*
* @param msg
*/
public abstract void printRaw(String msg);
/**
* Print a WorldEdit message.
*
* @param msg
*/
public abstract void printDebug(String msg);
/**
* Print a WorldEdit message.
*
* @param msg
*/
public abstract void print(String msg);
/**
* Print a WorldEdit error.
*
* @param msg
*/
public abstract void printError(String msg);
/** /**
* Move the player. * Move the player.
* *
@ -519,6 +560,13 @@ public abstract class LocalPlayer extends LocalCommandSender {
setPosition(pos, (float) getPitch(), (float) getYaw()); setPosition(pos, (float) getPitch(), (float) getYaw());
} }
/**
* Get a player's list of groups.
*
* @return
*/
public abstract String[] getGroups();
/** /**
* Get this player's block bag. * Get this player's block bag.
* *
@ -526,6 +574,36 @@ public abstract class LocalPlayer extends LocalCommandSender {
*/ */
public abstract BlockBag getInventoryBlockBag(); public abstract BlockBag getInventoryBlockBag();
/**
* Checks if a player has permission.
*
* @param perm
* @return
*/
public abstract boolean hasPermission(String perm);
/**
* Open a file open dialog.
*
* @param extensions null to allow all
* @return
*/
public File openFileOpenDialog(String[] extensions) {
printError("File dialogs are not supported in your environment.");
return null;
}
/**
* Open a file save dialog.
*
* @param extensions null to allow all
* @return
*/
public File openFileSaveDialog(String[] extensions) {
printError("File dialogs are not supported in your environment.");
return null;
}
/** /**
* Returns true if the player can destroy bedrock. * Returns true if the player can destroy bedrock.
* *
@ -549,8 +627,34 @@ public abstract class LocalPlayer extends LocalCommandSender {
public void dispatchCUIHandshake() { public void dispatchCUIHandshake() {
} }
/**
* Returns true if equal.
*
* @param other
* @return whether the other object is equivalent
*/
@Override @Override
public LocalPlayer asPlayer() { public boolean equals(Object other) {
return this; if (!(other instanceof LocalPlayer)) {
return false;
}
LocalPlayer other2 = (LocalPlayer) other;
return other2.getName().equals(getName());
}
/**
* Gets the hash code.
*
* @return hash code
*/
@Override
public int hashCode() {
return getName().hashCode();
}
public void checkPermission(String permission) throws WorldEditPermissionException {
if (!hasPermission(permission)) {
throw new WorldEditPermissionException();
}
} }
} }

Datei anzeigen

@ -1,5 +0,0 @@
package com.sk89q.worldedit;
public class PlayerNeededException extends WorldEditException {
private static final long serialVersionUID = 1L;
}