mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 02:25:41 +01:00
refactor!: Remove redundant MapInitializeEvent (#2507)
This commit is contained in:
parent
0117159159
commit
4ad6c53ba9
@ -82,7 +82,6 @@ import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVAsyncPlayerChatListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVChatListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVMapListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerChatListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPortalListener;
|
||||
@ -395,7 +394,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
pm.registerEvents(this.weatherListener, this);
|
||||
pm.registerEvents(this.portalListener, this);
|
||||
pm.registerEvents(this.worldListener, this);
|
||||
pm.registerEvents(new MVMapListener(this), this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,43 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.listeners;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.MapInitializeEvent;
|
||||
import org.bukkit.map.MapView;
|
||||
|
||||
/**
|
||||
* A listener for bukkit map events.
|
||||
*/
|
||||
public class MVMapListener implements Listener {
|
||||
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
public MVMapListener(final MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when a map is initialized.
|
||||
* @param event The event that was fired.
|
||||
*/
|
||||
@EventHandler
|
||||
public void mapInitialize(final MapInitializeEvent event) {
|
||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||
if ((player.getItemInHand().getType() == Material.MAP
|
||||
|| player.getItemInHand().getType() == Material.FILLED_MAP)
|
||||
&& player.getItemInHand().getDurability() == event.getMap().getId()) {
|
||||
final Location playerLoc = player.getLocation();
|
||||
final MapView map = event.getMap();
|
||||
map.setCenterX(playerLoc.getBlockX());
|
||||
map.setCenterZ(playerLoc.getBlockZ());
|
||||
map.setWorld(playerLoc.getWorld());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user