MassiveCommandException --> Exception
This commit is contained in:
parent
c1ead17379
commit
bea7ccae46
50
src/com/massivecraft/massivecore/MassiveException.java
Normal file
50
src/com/massivecraft/massivecore/MassiveException.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.massivecraft.massivecore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
|
||||
public class MassiveException extends Exception
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// MESSAGES
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected List<String> messages = new MassiveList<String>();
|
||||
public List<String> getMessages() { return this.messages; }
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return Txt.implode(this.getMessages(), "\n");
|
||||
}
|
||||
|
||||
public MassiveException setMessage(String message) { this.messages = new MassiveList<String>(message); return this; }
|
||||
public MassiveException setMsg(String msg) { return this.setMessage(Txt.parse(msg)); }
|
||||
public MassiveException setMsg(String msg, Object... args) { return this.setMessage(Txt.parse(msg, args)); }
|
||||
|
||||
public MassiveException addMessage(String message) { this.getMessages().add(message); return this; }
|
||||
public MassiveException addMsg(String msg) { return this.addMessage(Txt.parse(msg)); }
|
||||
public MassiveException addMsg(String msg, Object... args) { return this.addMessage(Txt.parse(msg, args)); }
|
||||
|
||||
public MassiveException setMessages(Collection<String> messages) { this.messages = new MassiveList<String>(messages); return this; }
|
||||
public MassiveException setMessages(String... messages) { return this.setMessages(Arrays.asList(messages)); }
|
||||
public MassiveException setMsgs(Collection<String> msgs) { return this.setMessages(Txt.parse(msgs)); }
|
||||
public MassiveException setMsgs(String... msgs) { return this.setMsgs(Arrays.asList(msgs)); }
|
||||
|
||||
public MassiveException addMessages(Collection<String> messages) { this.getMessages().addAll(messages); return this; }
|
||||
public MassiveException addMessages(String... messages) { return this.addMessages(Arrays.asList(messages)); }
|
||||
public MassiveException addMsgs(Collection<String> messages) { this.getMessages().addAll(messages); return this; }
|
||||
public MassiveException addMsgs(String... msgs) { return this.addMsgs(Arrays.asList(msgs)); }
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package com.massivecraft.massivecore.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -31,7 +32,7 @@ public class HelpCommand extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Args
|
||||
Integer pagenumber = this.arg(0, ARInteger.get(), 1);
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.massivecore.Lang;
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgReader;
|
||||
import com.massivecraft.massivecore.cmd.req.Req;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -344,7 +345,7 @@ public class MassiveCommand
|
||||
perform();
|
||||
}
|
||||
}
|
||||
catch (MassiveCommandException ex)
|
||||
catch (MassiveException ex)
|
||||
{
|
||||
// Sometimes ArgReaders (or commands themself) throw exceptions, to stop executing and notify the user.
|
||||
Mixin.messageOne(sender, ex.getMessages());
|
||||
@ -373,7 +374,7 @@ public class MassiveCommand
|
||||
}
|
||||
|
||||
// This is where the command action is performed.
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Per default we just act as the help command!
|
||||
List<MassiveCommand> commandChain = new ArrayList<MassiveCommand>(this.getCommandChain());
|
||||
@ -621,13 +622,13 @@ public class MassiveCommand
|
||||
return this.getArgs().get(idx);
|
||||
}
|
||||
|
||||
public <T> T arg(int idx, ArgReader<T> argReader) throws MassiveCommandException
|
||||
public <T> T arg(int idx, ArgReader<T> argReader) throws MassiveException
|
||||
{
|
||||
String str = this.arg(idx);
|
||||
return this.arg(str, argReader);
|
||||
}
|
||||
|
||||
public <T> T arg(int idx, ArgReader<T> argReader, T defaultNotSet) throws MassiveCommandException
|
||||
public <T> T arg(int idx, ArgReader<T> argReader, T defaultNotSet) throws MassiveException
|
||||
{
|
||||
String str = this.arg(idx);
|
||||
return this.arg(str, argReader, defaultNotSet);
|
||||
@ -644,13 +645,13 @@ public class MassiveCommand
|
||||
return Txt.implode(this.getArgs().subList(from, to), " ");
|
||||
}
|
||||
|
||||
public <T> T argConcatFrom(int idx, ArgReader<T> argReader) throws MassiveCommandException
|
||||
public <T> T argConcatFrom(int idx, ArgReader<T> argReader) throws MassiveException
|
||||
{
|
||||
String str = this.argConcatFrom(idx);
|
||||
return this.arg(str, argReader);
|
||||
}
|
||||
|
||||
public <T> T argConcatFrom(int idx, ArgReader<T> argReader, T defaultNotSet) throws MassiveCommandException
|
||||
public <T> T argConcatFrom(int idx, ArgReader<T> argReader, T defaultNotSet) throws MassiveException
|
||||
{
|
||||
String str = this.argConcatFrom(idx);
|
||||
return this.arg(str, argReader, defaultNotSet);
|
||||
@ -658,18 +659,18 @@ public class MassiveCommand
|
||||
|
||||
// Core & Other
|
||||
|
||||
public <T> T arg(ArgReader<T> argReader) throws MassiveCommandException
|
||||
public <T> T arg(ArgReader<T> argReader) throws MassiveException
|
||||
{
|
||||
return this.arg(null, argReader);
|
||||
}
|
||||
|
||||
public <T> T arg(String str, ArgReader<T> argReader) throws MassiveCommandException
|
||||
public <T> T arg(String str, ArgReader<T> argReader) throws MassiveException
|
||||
{
|
||||
T result = argReader.read(str, this.sender);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> T arg(String str, ArgReader<T> argReader, T defaultNotSet) throws MassiveCommandException
|
||||
public <T> T arg(String str, ArgReader<T> argReader, T defaultNotSet) throws MassiveException
|
||||
{
|
||||
if (str == null) return defaultNotSet;
|
||||
return this.arg(str, argReader);
|
||||
|
@ -1,69 +0,0 @@
|
||||
package com.massivecraft.massivecore.cmd;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class MassiveCommandException extends Exception
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCTORS
|
||||
// -------------------------------------------- //
|
||||
/*
|
||||
public MassiveCommandException()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MassiveCommandException(String msg)
|
||||
{
|
||||
this.messages.add(msg);
|
||||
}
|
||||
|
||||
public MassiveCommandException(Collection<String> msgs)
|
||||
{
|
||||
this.messages.addAll(msgs);
|
||||
}
|
||||
*/
|
||||
|
||||
// -------------------------------------------- //
|
||||
// MESSAGES
|
||||
// -------------------------------------------- //
|
||||
|
||||
private List<String> messages = new MassiveList<String>();
|
||||
public List<String> getMessages() { return this.messages; }
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return Txt.implode(this.getMessages(), "\n");
|
||||
}
|
||||
|
||||
public MassiveCommandException setMessage(String message) { this.messages = new MassiveList<String>(message); return this; }
|
||||
public MassiveCommandException setMsg(String msg) { return this.setMessage(Txt.parse(msg)); }
|
||||
public MassiveCommandException setMsg(String msg, Object... args) { return this.setMessage(Txt.parse(msg, args)); }
|
||||
|
||||
public MassiveCommandException addMessage(String message) { this.getMessages().add(message); return this; }
|
||||
public MassiveCommandException addMsg(String msg) { return this.addMessage(Txt.parse(msg)); }
|
||||
public MassiveCommandException addMsg(String msg, Object... args) { return this.addMessage(Txt.parse(msg, args)); }
|
||||
|
||||
public MassiveCommandException setMessages(Collection<String> messages) { this.messages = new MassiveList<String>(messages); return this; }
|
||||
public MassiveCommandException setMessages(String... messages) { return this.setMessages(Arrays.asList(messages)); }
|
||||
public MassiveCommandException setMsgs(Collection<String> msgs) { return this.setMessages(Txt.parse(msgs)); }
|
||||
public MassiveCommandException setMsgs(String... msgs) { return this.setMsgs(Arrays.asList(msgs)); }
|
||||
|
||||
public MassiveCommandException addMessages(Collection<String> messages) { this.getMessages().addAll(messages); return this; }
|
||||
public MassiveCommandException addMessages(String... messages) { return this.addMessages(Arrays.asList(messages)); }
|
||||
public MassiveCommandException addMsgs(Collection<String> messages) { this.getMessages().addAll(messages); return this; }
|
||||
public MassiveCommandException addMsgs(String... msgs) { return this.addMsgs(Arrays.asList(msgs)); }
|
||||
|
||||
}
|
@ -2,7 +2,7 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public abstract class ARAbstractPrimitive<T> extends ArgReaderAbstract<T>
|
||||
{
|
||||
@ -18,7 +18,7 @@ public abstract class ARAbstractPrimitive<T> extends ArgReaderAbstract<T>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public T read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public T read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
T result;
|
||||
|
||||
@ -28,7 +28,7 @@ public abstract class ARAbstractPrimitive<T> extends ArgReaderAbstract<T>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new MassiveCommandException().addMsg("<b>Invalid %s \"<h>%s\"<b>.", this.typename(), arg);
|
||||
throw new MassiveException().addMsg("<b>Invalid %s \"<h>%s\"<b>.", this.typename(), arg);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -4,7 +4,7 @@ import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class ARAbstractSelect<T> extends ArgReaderAbstract<T>
|
||||
@ -29,13 +29,13 @@ public abstract class ARAbstractSelect<T> extends ArgReaderAbstract<T>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public T read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public T read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
T result = this.select(arg, sender);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
MassiveCommandException exception = new MassiveCommandException();
|
||||
MassiveException exception = new MassiveException();
|
||||
exception.addMsg("<b>No %s matches \"<h>%s<b>\".", this.typename(), arg);
|
||||
|
||||
if (this.canList(sender))
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARList<T> extends ArgReaderAbstract<List<T>>
|
||||
{
|
||||
@ -36,7 +36,7 @@ public class ARList<T> extends ArgReaderAbstract<List<T>>
|
||||
|
||||
// NOTE: Must be used with argConcatFrom and setErrorOnTooManyArgs(false).
|
||||
@Override
|
||||
public List<T> read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public List<T> read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
// Split into inner args
|
||||
String[] innerArgs = arg.split("\\s+");
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARMaterial extends ArgReaderAbstract<Material>
|
||||
{
|
||||
@ -19,12 +19,12 @@ public class ARMaterial extends ArgReaderAbstract<Material>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Material read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public Material read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
Material ret = Material.matchMaterial(arg);
|
||||
if (ret == null)
|
||||
{
|
||||
MassiveCommandException exception = new MassiveCommandException();
|
||||
MassiveException exception = new MassiveException();
|
||||
exception.addMsg("<b>No material matches <h>%s<b>.", arg);
|
||||
exception.addMsg("<i>Suggestion: <aqua>http://www.minecraftwiki.net/wiki/Data_values");
|
||||
throw exception;
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
|
||||
public class ARMillisDiff extends ArgReaderAbstract<Long>
|
||||
@ -19,7 +19,7 @@ public class ARMillisDiff extends ArgReaderAbstract<Long>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Long read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public Long read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
Long ret;
|
||||
try
|
||||
@ -28,7 +28,7 @@ public class ARMillisDiff extends ArgReaderAbstract<Long>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new MassiveCommandException().addMsg("<b>%s", e.getMessage());
|
||||
throw new MassiveException().addMsg("<b>%s", e.getMessage());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARPermission extends ArgReaderAbstract<Permission>
|
||||
{
|
||||
@ -20,7 +20,7 @@ public class ARPermission extends ArgReaderAbstract<Permission>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Permission read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public Permission read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
Permission ret = null;
|
||||
|
||||
@ -33,7 +33,7 @@ public class ARPermission extends ArgReaderAbstract<Permission>
|
||||
|
||||
if (ret == null)
|
||||
{
|
||||
throw new MassiveCommandException().addMsg("<b>No permission with the name \"<h>%s<b>\" was found.", arg);
|
||||
throw new MassiveException().addMsg("<b>No permission with the name \"<h>%s<b>\" was found.", arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -4,7 +4,7 @@ import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.store.SenderIdSource;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
@ -44,7 +44,7 @@ public abstract class ARSenderIdAbstract<T> extends ArgReaderAbstract<T>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public T read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public T read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
// Create Ret
|
||||
T ret;
|
||||
@ -60,7 +60,7 @@ public abstract class ARSenderIdAbstract<T> extends ArgReaderAbstract<T>
|
||||
if (ret == null)
|
||||
{
|
||||
// No alternatives found
|
||||
throw new MassiveCommandException().addMsg("<b>No player matches \"<h>%s<b>\".", arg);
|
||||
throw new MassiveException().addMsg("<b>No player matches \"<h>%s<b>\".", arg);
|
||||
}
|
||||
|
||||
// Return Ret
|
||||
|
@ -5,7 +5,7 @@ import java.util.Set;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARSet<T> extends ArgReaderAbstract<Set<T>>
|
||||
@ -41,7 +41,7 @@ public class ARSet<T> extends ArgReaderAbstract<Set<T>>
|
||||
|
||||
// NOTE: Must be used with argConcatFrom and setErrorOnTooManyArgs(false).
|
||||
@Override
|
||||
public Set<T> read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public Set<T> read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
// Split into inner args
|
||||
String[] innerArgs = arg.split("\\s+");
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARSound extends ArgReaderAbstract<Sound>
|
||||
{
|
||||
@ -19,12 +19,12 @@ public class ARSound extends ArgReaderAbstract<Sound>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Sound read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public Sound read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
Sound result = getSoundFromString(arg);
|
||||
if (result == null)
|
||||
{
|
||||
MassiveCommandException errors = new MassiveCommandException();
|
||||
MassiveException errors = new MassiveException();
|
||||
errors.addMsg("<b>No sound matches \"<h>%s<b>\".", arg);
|
||||
errors.addMsg("<aqua>https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Sound.java");
|
||||
throw errors;
|
||||
|
@ -2,8 +2,8 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.SoundEffect;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
|
||||
public class ARSoundEffect extends ArgReaderAbstract<SoundEffect>
|
||||
{
|
||||
@ -19,7 +19,7 @@ public class ARSoundEffect extends ArgReaderAbstract<SoundEffect>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public SoundEffect read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public SoundEffect read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
SoundEffect ret;
|
||||
|
||||
@ -29,7 +29,7 @@ public class ARSoundEffect extends ArgReaderAbstract<SoundEffect>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new MassiveCommandException().addMsg("<b>%s", e.getMessage());
|
||||
throw new MassiveException().addMsg("<b>%s", e.getMessage());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.SoundEffect;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
|
||||
/**
|
||||
* @deprecated use ARList
|
||||
@ -27,7 +27,7 @@ public class ARSoundEffects extends ArgReaderAbstract<List<SoundEffect>>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public List<SoundEffect> read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public List<SoundEffect> read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
List<SoundEffect> ret = new ArrayList<SoundEffect>();
|
||||
List<SoundEffect> result = new ArrayList<SoundEffect>();
|
||||
@ -45,7 +45,7 @@ public class ARSoundEffects extends ArgReaderAbstract<List<SoundEffect>>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new MassiveCommandException().addMsg("<b>%s", e.getMessage());
|
||||
throw new MassiveException().addMsg("<b>%s", e.getMessage());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARUniverse extends ArgReaderAbstract<String>
|
||||
@ -32,7 +32,7 @@ public class ARUniverse extends ArgReaderAbstract<String>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public String read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
String result = new String();
|
||||
|
||||
@ -42,7 +42,7 @@ public class ARUniverse extends ArgReaderAbstract<String>
|
||||
}
|
||||
else
|
||||
{
|
||||
MassiveCommandException exception = new MassiveCommandException();
|
||||
MassiveException exception = new MassiveException();
|
||||
exception.addMsg("<b>No universe \"<h>%s<b>\" exists in multiverse <h>%s<b>.", arg, this.multiverse.getId());
|
||||
|
||||
Collection<String> names = new ArrayList<String>(multiverse.getUniverses());
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class ARWorld extends ArgReaderAbstract<World>
|
||||
{
|
||||
@ -20,7 +20,7 @@ public class ARWorld extends ArgReaderAbstract<World>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public World read(String arg, CommandSender sender) throws MassiveCommandException
|
||||
public World read(String arg, CommandSender sender) throws MassiveException
|
||||
{
|
||||
World ret;
|
||||
|
||||
@ -32,7 +32,7 @@ public class ARWorld extends ArgReaderAbstract<World>
|
||||
|
||||
if (ret == null)
|
||||
{
|
||||
throw new MassiveCommandException().addMsg("<b>The world \"<h>%s<b>\" could not be found.", arg);
|
||||
throw new MassiveException().addMsg("<b>The world \"<h>%s<b>\" could not be found.", arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2,12 +2,12 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public interface ArgReader<T>
|
||||
{
|
||||
public T read(String arg, CommandSender sender) throws MassiveCommandException;
|
||||
public T read(CommandSender sender) throws MassiveCommandException;
|
||||
public T read(String arg) throws MassiveCommandException;
|
||||
public T readArg() throws MassiveCommandException;
|
||||
public T read(String arg, CommandSender sender) throws MassiveException;
|
||||
public T read(CommandSender sender) throws MassiveException;
|
||||
public T read(String arg) throws MassiveException;
|
||||
public T readArg() throws MassiveException;
|
||||
}
|
@ -2,7 +2,7 @@ package com.massivecraft.massivecore.cmd.arg;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public abstract class ArgReaderAbstract<T> implements ArgReader<T>
|
||||
{
|
||||
@ -11,19 +11,19 @@ public abstract class ArgReaderAbstract<T> implements ArgReader<T>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public T read(CommandSender sender) throws MassiveCommandException
|
||||
public T read(CommandSender sender) throws MassiveException
|
||||
{
|
||||
return this.read(null, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T read(String arg) throws MassiveCommandException
|
||||
public T read(String arg) throws MassiveException
|
||||
{
|
||||
return this.read(arg, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T readArg() throws MassiveCommandException
|
||||
public T readArg() throws MassiveException
|
||||
{
|
||||
return this.read(null, null);
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCoreEngineVariable;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -31,7 +31,7 @@ public class CmdMassiveCoreBufferWhitespace extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Integer times = this.arg(0, ARInteger.get(), 1);
|
||||
|
||||
|
@ -3,9 +3,9 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.SoundEffect;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARList;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSoundEffect;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -36,7 +36,7 @@ public class CmdMassiveCoreHearsound extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Args
|
||||
List<SoundEffect> soundEffects = this.argConcatFrom(0, ARList.get(ARSoundEffect.get()));
|
||||
|
@ -5,9 +5,9 @@ import java.util.TreeSet;
|
||||
|
||||
import com.massivecraft.massivecore.ConfServer;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.NaturalOrderComparator;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.store.Coll;
|
||||
@ -38,7 +38,7 @@ public class CmdMassiveCoreStoreListcolls extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Args
|
||||
final String dbAlias = this.arg(0, ARString.get(), ConfServer.dburi);
|
||||
|
@ -3,8 +3,8 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARColl;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.store.Coll;
|
||||
@ -35,7 +35,7 @@ public class CmdMassiveCoreStoreStats extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
if (!this.argIsSet(0) || this.arg(0).equalsIgnoreCase(Coll.TOTAL))
|
||||
{
|
||||
|
@ -4,8 +4,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.VisibilityMode;
|
||||
import com.massivecraft.massivecore.cmd.arg.AREnum;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARFloat;
|
||||
@ -46,7 +46,7 @@ public class CmdMassiveCoreTest extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Args
|
||||
ParticleEffect particleEffect = this.arg(0, AREnum.get(ParticleEffect.class));
|
||||
|
@ -6,8 +6,8 @@ import java.util.List;
|
||||
import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.AspectColl;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -35,7 +35,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Args
|
||||
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
|
||||
|
@ -2,8 +2,8 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARAspect;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -31,7 +31,7 @@ public class CmdMassiveCoreUsysAspectShow extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Aspect aspect = this.arg(0, ARAspect.get());
|
||||
|
||||
|
@ -2,9 +2,9 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARAspect;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -33,7 +33,7 @@ public class CmdMassiveCoreUsysAspectUse extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Aspect aspect = this.arg(0, ARAspect.get());
|
||||
Multiverse multiverse = this.arg(1, ARMultiverse.get());
|
||||
|
@ -2,9 +2,9 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -31,7 +31,7 @@ public class CmdMassiveCoreUsysMultiverseDel extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Multiverse multiverse = this.arg(0, ARMultiverse.get());
|
||||
|
||||
|
@ -4,10 +4,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.MultiverseColl;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -35,7 +35,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
// Args
|
||||
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
|
||||
|
@ -6,9 +6,9 @@ import java.util.List;
|
||||
import com.massivecraft.massivecore.Aspect;
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -36,7 +36,7 @@ public class CmdMassiveCoreUsysMultiverseShow extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Multiverse multiverse = this.arg(0, ARMultiverse.get());
|
||||
|
||||
|
@ -2,9 +2,9 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -32,7 +32,7 @@ public class CmdMassiveCoreUsysUniverseClear extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Multiverse multiverse = this.arg(1, ARMultiverse.get());
|
||||
|
||||
|
@ -2,9 +2,9 @@ package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -32,7 +32,7 @@ public class CmdMassiveCoreUsysUniverseDel extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Multiverse multiverse = this.arg(1, ARMultiverse.get());
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -31,7 +31,7 @@ public class CmdMassiveCoreUsysUniverseNew extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Multiverse multiverse = this.arg(1, ARMultiverse.get());
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.massivecraft.massivecore.cmd.massivecore;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveCorePerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Multiverse;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -32,7 +32,7 @@ public class CmdMassiveCoreUsysWorld extends MassiveCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveCommandException
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Multiverse multiverse = this.arg(2, ARMultiverse.get());
|
||||
|
||||
|
@ -375,7 +375,7 @@ public class Txt
|
||||
public static String getNicedEnumString(String str)
|
||||
{
|
||||
List<String> parts = new ArrayList<String>();
|
||||
for (String part : str.toLowerCase().split("_"))
|
||||
for (String part : str.toLowerCase().split("[\\s_]+"))
|
||||
{
|
||||
parts.add(upperCaseFirst(part));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user