style: Camera

This commit is contained in:
Laureηt 2022-05-16 21:15:22 +02:00
parent 7bfa1e105c
commit dedc389369
No known key found for this signature in database
GPG key ID: D88C6B294FD40994

View file

@ -44,6 +44,39 @@ public class Camera extends JavaPlugin implements Listener {
getServer().getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
ClearPoints.clear();
}
// ----------------------------------------------------------------------------------------------------
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
ItemStack helditem = player.getPlayer().getInventory().getItemInMainHand();
switch (helditem.getType()) {
case STICK:
player.chat("/point add");
break;
case PAPER:
player.chat("/show");
break;
case SLIME_BALL:
player.chat("/exec");
break;
case BRICK:
ClearPoints.clear();
break;
default:
break;
}
}
}
public static void compute() {
int nControlPoints = controlPoints.size();
@ -91,11 +124,6 @@ public class Camera extends JavaPlugin implements Listener {
}
}
public static void broadlog(String msg) {
Camera.logger.log(Level.INFO, msg);
Bukkit.broadcastMessage(msg);
}
public static String prettyLocation(LocationQuaternion point) {
point.updateEulerAngles();
return String.format("X=%05.2f, Y=%05.2f, Z=%05.2f, P=%05.2f, Y=%05.2f",
@ -103,34 +131,9 @@ public class Camera extends JavaPlugin implements Listener {
point.getPitch(), point.getYaw());
}
@Override
public void onDisable() {
ClearPoints.clear();
public static void broadlog(String msg) {
Camera.logger.log(Level.INFO, msg);
Bukkit.broadcastMessage(msg);
}
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
ItemStack helditem = player.getPlayer().getInventory().getItemInMainHand();
switch (helditem.getType()) {
case STICK:
player.chat("/point add");
break;
case PAPER:
player.chat("/show");
break;
case SLIME_BALL:
player.chat("/exec");
break;
case BRICK:
player.chat("/reset");
break;
default:
break;
}
}
}
}