Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 19:10:07 +01:00
Updated for latest Bukkit.
Dieser Commit ist enthalten in:
Ursprung
cd54bb6f09
Commit
63beba8cba
@ -38,7 +38,7 @@ public class PermissionsResolverServerListener extends ServerListener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPluginEnabled(PluginEvent event) {
|
||||
public void onPluginEnable(PluginEvent event) {
|
||||
Plugin plugin = event.getPlugin();
|
||||
String name = plugin.getDescription().getName();
|
||||
|
||||
@ -56,7 +56,7 @@ public class PermissionsResolverServerListener extends ServerListener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPluginDisabled(PluginEvent event) {
|
||||
public void onPluginDisable(PluginEvent event) {
|
||||
Plugin plugin = event.getPlugin();
|
||||
String name = plugin.getDescription().getName();
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class BukkitPlayer extends LocalPlayer {
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||
player.teleportTo(new Location(player.getWorld(), pos.getX(), pos.getY(),
|
||||
player.teleport(new Location(player.getWorld(), pos.getX(), pos.getY(),
|
||||
pos.getZ(), yaw, pitch));
|
||||
}
|
||||
|
||||
|
@ -1,79 +0,0 @@
|
||||
// $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.entity.Player;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.BlockRightClickEvent;
|
||||
|
||||
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 damaged (or broken)
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
LocalWorld world = new BukkitWorld(event.getBlock().getWorld());
|
||||
WorldVector pos = new WorldVector(world, event.getBlock().getX(),
|
||||
event.getBlock().getY(), event.getBlock().getZ());
|
||||
LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||
|
||||
if (plugin.controller.handleBlockLeftClick(player, pos)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks a block
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockRightClick(BlockRightClickEvent event) {
|
||||
LocalWorld world = new BukkitWorld(event.getBlock().getWorld());
|
||||
WorldVector pos = new WorldVector(world, event.getBlock().getX(),
|
||||
event.getBlock().getY(), event.getBlock().getZ());
|
||||
LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||
|
||||
plugin.controller.handleBlockRightClick(player, pos);
|
||||
}
|
||||
|
||||
private BukkitPlayer wrapPlayer(Player player) {
|
||||
return new BukkitPlayer(plugin, plugin.server, player);
|
||||
}
|
||||
}
|
@ -20,13 +20,15 @@
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.WorldVector;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
@ -93,16 +95,40 @@ public class WorldEditPlayerListener extends PlayerListener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a player uses an item
|
||||
*
|
||||
* Called when a player interacts
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) {
|
||||
event.setCancelled(true);
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
|
||||
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
|
||||
event.getClickedBlock().getY(), event.getClickedBlock().getZ());
|
||||
LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||
|
||||
if (plugin.controller.handleBlockLeftClick(player, pos)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
LocalWorld world = new BukkitWorld(event.getClickedBlock().getWorld());
|
||||
WorldVector pos = new WorldVector(world, event.getClickedBlock().getX(),
|
||||
event.getClickedBlock().getY(), event.getClickedBlock().getZ());
|
||||
LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||
|
||||
if (plugin.controller.handleBlockRightClick(player, pos)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (event.getAction() == Action.RIGHT_CLICK_AIR) {
|
||||
if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,14 +126,11 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
protected void registerEvents() {
|
||||
PlayerListener playerListener = new WorldEditPlayerListener(this);
|
||||
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
|
||||
BlockListener blockListener = new WorldEditBlockListener(this);
|
||||
|
||||
registerEvent(Event.Type.PLAYER_QUIT, playerListener);
|
||||
registerEvent(Event.Type.PLAYER_ANIMATION, playerListener);
|
||||
registerEvent(Event.Type.PLAYER_ITEM, playerListener);
|
||||
registerEvent(Event.Type.PLAYER_INTERACT, playerListener);
|
||||
registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener);
|
||||
registerEvent(Event.Type.BLOCK_DAMAGED, blockListener);
|
||||
registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener);
|
||||
registerEvent(Event.Type.PLAYER_JOIN, criticalPlayerListener, Priority.Lowest);
|
||||
|
||||
// The permissions resolver has some hooks of its own
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren