geforkt von Mirrors/FastAsyncWorldEdit
Initial commit.
Dieser Commit ist enthalten in:
Ursprung
d0cdddea7e
Commit
ebf204cbc3
@ -21,6 +21,7 @@
|
|||||||
<include name="jnbt.jar" />
|
<include name="jnbt.jar" />
|
||||||
<include name="Minecraft_Mod.jar" />
|
<include name="Minecraft_Mod.jar" />
|
||||||
<include name="minecraft_server.jar" />
|
<include name="minecraft_server.jar" />
|
||||||
|
<include name="Bukkit.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</classpath>
|
</classpath>
|
||||||
</javac>
|
</javac>
|
||||||
|
122
src/com/sk89q/worldedit/bukkit/BukkitPlayer.java
Normale Datei
122
src/com/sk89q/worldedit/bukkit/BukkitPlayer.java
Normale Datei
@ -0,0 +1,122 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.*;
|
||||||
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.bags.BlockBag;
|
||||||
|
|
||||||
|
public class BukkitPlayer extends WorldEditPlayer {
|
||||||
|
private Player player;
|
||||||
|
|
||||||
|
public BukkitPlayer(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector getBlockTrace(int range) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector getSolidBlockTrace(int range) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemInHand() {
|
||||||
|
ItemStack itemStack = player.getSelectedItem();
|
||||||
|
return itemStack != null ? itemStack.getTypeID() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return player.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector getPosition() {
|
||||||
|
Location loc = player.getLocation();
|
||||||
|
return new Vector(loc.getX(), loc.getY(), loc.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getPitch() {
|
||||||
|
return player.getLocation().getPitch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getYaw() {
|
||||||
|
return player.getLocation().getYaw();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void giveItem(int type, int amt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean passThroughForwardWall(int range) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void printRaw(String msg) {
|
||||||
|
player.sendMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void print(String msg) {
|
||||||
|
player.sendMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void printError(String msg) {
|
||||||
|
player.sendMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getGroups() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockBag getInventoryBlockBag() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(String perm) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
147
src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java
Normale Datei
147
src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java
Normale Datei
@ -0,0 +1,147 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.*;
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.ServerInterface;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
|
|
||||||
|
public class BukkitServerInterface extends ServerInterface {
|
||||||
|
public Server server;
|
||||||
|
|
||||||
|
public BukkitServerInterface(Server server) {
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setBlockType(Vector pt, int type) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBlockType(Vector pt) {
|
||||||
|
return server.getWorlds()[0].getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockData(Vector pt, int data) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBlockData(Vector pt) {
|
||||||
|
return server.getWorlds()[0].getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSignText(Vector pt, String[] text) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getSignText(Vector pt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseItemStack[] getChestContents(Vector pt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setChestContents(Vector pt, BaseItemStack[] contents) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean clearChest(Vector pt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidMobType(String type) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMobSpawnerType(Vector pt, String mobType) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMobSpawnerType(Vector pt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generateTree(EditSession editSession, Vector pt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector pt, int type, int count, int times) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector pt, int type, int count) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector pt, int type) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simulateBlockMine(Vector pt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int resolveItem(String name) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int killMobs(Vector origin, int radius) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java
Normale Datei
67
src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java
Normale Datei
@ -0,0 +1,67 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.event.block.BlockListener;
|
||||||
|
import org.bukkit.event.block.BlockBrokenEvent;
|
||||||
|
import org.bukkit.event.block.BlockRightClickedEvent;
|
||||||
|
import com.sk89q.worldedit.*;
|
||||||
|
|
||||||
|
public class WorldEditBlockListener extends BlockListener {
|
||||||
|
/**
|
||||||
|
* Plugin.
|
||||||
|
*/
|
||||||
|
private WorldEditPlugin plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the object;
|
||||||
|
*
|
||||||
|
* @param plugin
|
||||||
|
*/
|
||||||
|
public WorldEditBlockListener(WorldEditPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a block is broken (or destroyed)
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onBlockBroken(BlockBrokenEvent event) {
|
||||||
|
Vector pos = new Vector(event.getBlock().getX(),
|
||||||
|
event.getBlock().getY(),
|
||||||
|
event.getBlock().getZ());
|
||||||
|
WorldEditPlayer player = new BukkitPlayer(plugin.getServer().getOnlinePlayers()[0]);
|
||||||
|
plugin.controller.handleBlockLeftClick(player, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player right clicks a block
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onBlockRightClicked(BlockRightClickedEvent event) {
|
||||||
|
Vector pos = new Vector(event.getBlock().getX(),
|
||||||
|
event.getBlock().getY(),
|
||||||
|
event.getBlock().getZ());
|
||||||
|
WorldEditPlayer player = new BukkitPlayer(plugin.getServer().getOnlinePlayers()[0]);
|
||||||
|
plugin.controller.handleBlockRightClick(player, pos);
|
||||||
|
}
|
||||||
|
}
|
65
src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java
Normale Datei
65
src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java
Normale Datei
@ -0,0 +1,65 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.WorldEditPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles all events thrown in relation to a Player
|
||||||
|
*/
|
||||||
|
public class WorldEditPlayerListener extends PlayerListener {
|
||||||
|
/**
|
||||||
|
* Plugin.
|
||||||
|
*/
|
||||||
|
private WorldEditPlugin plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the object;
|
||||||
|
*
|
||||||
|
* @param plugin
|
||||||
|
*/
|
||||||
|
public WorldEditPlayerListener(WorldEditPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player leaves a server
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onPlayerQuit(PlayerEvent event) {
|
||||||
|
WorldEditPlayer player = new BukkitPlayer(plugin.getServer().getOnlinePlayers()[0]);
|
||||||
|
plugin.controller.handleDisconnect(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player attempts to use a command
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onPlayerCommand(PlayerChatEvent event) {
|
||||||
|
WorldEditPlayer player = new BukkitPlayer(plugin.getServer().getOnlinePlayers()[0]);
|
||||||
|
plugin.controller.handleCommand(player, event.getMessage().split(" "));
|
||||||
|
}
|
||||||
|
}
|
85
src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java
Normale Datei
85
src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java
Normale Datei
@ -0,0 +1,85 @@
|
|||||||
|
// $Id$
|
||||||
|
/*
|
||||||
|
* WorldEdit
|
||||||
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.Event.Priority;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import com.sk89q.worldedit.*;
|
||||||
|
|
||||||
|
public class WorldEditPlugin extends JavaPlugin {
|
||||||
|
public final WorldEditController controller =
|
||||||
|
new WorldEditController();
|
||||||
|
|
||||||
|
private final WorldEditPlayerListener playerListener =
|
||||||
|
new WorldEditPlayerListener(this);
|
||||||
|
private final WorldEditBlockListener blockListener =
|
||||||
|
new WorldEditBlockListener(this);
|
||||||
|
|
||||||
|
public WorldEditPlugin(PluginLoader pluginLoader, Server instance,
|
||||||
|
PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
|
||||||
|
super(pluginLoader, instance, desc, plugin, cLoader);
|
||||||
|
|
||||||
|
registerEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onEnable() {
|
||||||
|
//loadConfiguration();
|
||||||
|
|
||||||
|
ServerInterface.setup(new BukkitServerInterface(getServer()));
|
||||||
|
|
||||||
|
controller.profile = true;
|
||||||
|
controller.allowedBlocks = new HashSet<Integer>();
|
||||||
|
controller.defaultChangeLimit = -1;
|
||||||
|
controller.maxChangeLimit = -1;
|
||||||
|
controller.shellSaveType = "sh";
|
||||||
|
controller.snapshotRepo = null;
|
||||||
|
controller.maxRadius = -1;
|
||||||
|
controller.maxSuperPickaxeSize = 5;
|
||||||
|
controller.logComands = false;
|
||||||
|
controller.registerHelp = true;
|
||||||
|
controller.wandItem = 271;
|
||||||
|
controller.superPickaxeDrop = true;
|
||||||
|
controller.superPickaxeManyDrop = true;
|
||||||
|
controller.noDoubleSlash = true;
|
||||||
|
controller.useInventory = false;
|
||||||
|
controller.useInventoryOverride = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {
|
||||||
|
controller.clearSessions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerEvents() {
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT,
|
||||||
|
playerListener, Priority.Normal, this);
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND,
|
||||||
|
playerListener, Priority.Normal, this);
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED,
|
||||||
|
blockListener, Priority.Normal, this);
|
||||||
|
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_RIGHTCLICKED,
|
||||||
|
blockListener, Priority.Normal, this);
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren