mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-25 12:06:17 +01:00
added error catcher for portal command args.
This commit is contained in:
parent
7bcd88fd1d
commit
06794ac4a7
@ -2,6 +2,7 @@ package com.sekwah.advancedportals.effects;
|
|||||||
|
|
||||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||||
import com.sekwah.advancedportals.Assets;
|
import com.sekwah.advancedportals.Assets;
|
||||||
|
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -17,20 +18,29 @@ public class WarpEffects {
|
|||||||
public static boolean soundError = false;
|
public static boolean soundError = false;
|
||||||
|
|
||||||
public WarpEffects(AdvancedPortalsPlugin plugin) {
|
public WarpEffects(AdvancedPortalsPlugin plugin) {
|
||||||
try {
|
|
||||||
sounds[0] = Sound.valueOf("ENTITY_ENDERMEN_TELEPORT");
|
sounds[0] = findSound(plugin, "ENTITY_ENDERMEN_TELEPORT", "ENDERMAN_TELEPORT");
|
||||||
plugin.getLogger().info("Sounds found");
|
|
||||||
|
// SPIGOT STOP CHANGING THE BLOODY NAMES! we already knew what an explosion was...
|
||||||
|
sounds[1] = findSound(plugin, "ENTITY_GENERIC_EXPLODE", "EXPLODE");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Sound findSound(AdvancedPortalsPlugin plugin, String newName, String oldName){
|
||||||
|
Sound soundFound = null;
|
||||||
|
try{
|
||||||
|
soundFound = Sound.valueOf(newName);
|
||||||
|
plugin.getLogger().info(newName + " found");
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
plugin.getLogger().info("Using old effect names");
|
|
||||||
try {
|
try {
|
||||||
sounds[0] = Sound.valueOf("ENDERMAN_TELEPORT");
|
soundFound = Sound.valueOf(oldName);
|
||||||
|
plugin.getLogger().info("Using old effect name: " + oldName);
|
||||||
} catch (IllegalArgumentException e2) {
|
} catch (IllegalArgumentException e2) {
|
||||||
plugin.getLogger().warning("There was an error using both the old and new names.");
|
plugin.getLogger().warning("There was an error using both the old and new names for " + newName);
|
||||||
soundError = true;
|
soundError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return soundFound;
|
||||||
sounds[1] = Sound.EXPLODE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void activateParticles(Player player) {
|
public static void activateParticles(Player player) {
|
||||||
|
@ -379,7 +379,12 @@ public class Portal {
|
|||||||
if (command.startsWith("#")) {
|
if (command.startsWith("#")) {
|
||||||
command = command.substring(1);
|
command = command.substring(1);
|
||||||
plugin.getLogger().log(Level.INFO, "Portal command: " + command);
|
plugin.getLogger().log(Level.INFO, "Portal command: " + command);
|
||||||
|
try{
|
||||||
plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
plugin.getLogger().warning("Error while executing: " + command);
|
||||||
|
}
|
||||||
} else if (command.startsWith("!")) {
|
} else if (command.startsWith("!")) {
|
||||||
command = command.substring(1);
|
command = command.substring(1);
|
||||||
boolean wasOp = player.isOp();
|
boolean wasOp = player.isOp();
|
||||||
|
Loading…
Reference in New Issue
Block a user