This is 6.9.0, now with fully dynamic command registration.
This commit is contained in:
parent
4b03dd4e2b
commit
86db5a6bdd
@ -1,6 +1,6 @@
|
||||
main: com.massivecraft.mcore.MCore
|
||||
name: mcore
|
||||
version: 6.8.1
|
||||
version: 6.9.0
|
||||
website: http://massivecraft.com/mcore
|
||||
authors: [Cayorion]
|
||||
description: §eMCore stands for MassiveCraft Core and is a plugin that contains libraries and features that other plugins make use of. §aCayorion §efrom the minecraft server §aMassiveCraft §eis the lead programmer. Feel free to visit us at §bhttp://massivecraft.com
|
||||
|
@ -45,4 +45,5 @@ public class AspectColl extends Coll<Aspect>
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package com.massivecraft.mcore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
|
||||
public class ConfServer extends SimpleConfig
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
@ -23,16 +21,12 @@ public class ConfServer extends SimpleConfig
|
||||
|
||||
public static String serverid = UUID.randomUUID().toString();
|
||||
|
||||
public static String dburi = "default";
|
||||
|
||||
public static Map<String, String> alias2uri = MUtil.map(
|
||||
"default", "flatfile",
|
||||
"flatfile", "flatfile://mstore",
|
||||
"mongodb", "mongodb://localhost:27017/mstore"
|
||||
);
|
||||
|
||||
public static String dburi = "default";
|
||||
|
||||
public static List<String> aliasesOuterMCore = MUtil.list("mcore");
|
||||
public static List<String> aliasesOuterMCoreUsys = MUtil.list("usys");
|
||||
public static List<String> aliasesOuterMCoreMStore = MUtil.list("mstore");
|
||||
|
||||
}
|
||||
|
@ -100,5 +100,4 @@ public class Couple<A, B> implements Entry<A, B>, Cloneable, Serializable
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
16
src/com/massivecraft/mcore/Engine.java
Normal file
16
src/com/massivecraft/mcore/Engine.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.massivecraft.mcore;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public interface Engine extends Listener, Runnable
|
||||
{
|
||||
public Plugin getPlugin();
|
||||
|
||||
public void activate();
|
||||
public void deactivate();
|
||||
|
||||
public Long getDelay();
|
||||
public Long getPeriod();
|
||||
public Integer getTaskId();
|
||||
}
|
58
src/com/massivecraft/mcore/EngineAbstract.java
Normal file
58
src/com/massivecraft/mcore/EngineAbstract.java
Normal file
@ -0,0 +1,58 @@
|
||||
package com.massivecraft.mcore;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public abstract class EngineAbstract implements Engine
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private Integer taskId;
|
||||
@Override public Integer getTaskId() { return this.taskId; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(this, this.getPlugin());
|
||||
if (this.getPeriod() != null)
|
||||
{
|
||||
this.taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(this.getPlugin(), this, this.getDelay(), this.getPeriod());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate()
|
||||
{
|
||||
HandlerList.unregisterAll(this);
|
||||
if (this.getTaskId() != null)
|
||||
{
|
||||
Bukkit.getScheduler().cancelTask(this.getTaskId());
|
||||
this.taskId = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getDelay()
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getPeriod()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
@ -22,6 +21,7 @@ import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.mcore.event.MCoreAfterPlayerRespawnEvent;
|
||||
import com.massivecraft.mcore.event.MCoreAfterPlayerTeleportEvent;
|
||||
@ -36,23 +36,30 @@ import com.massivecraft.mcore.store.SenderColl;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
import com.massivecraft.mcore.util.SmokeUtil;
|
||||
|
||||
public class InternalListener implements Listener
|
||||
public class EngineMainMCore extends EngineAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static InternalListener i = new InternalListener();
|
||||
public static InternalListener get() { return i; }
|
||||
private static EngineMainMCore i = new EngineMainMCore();
|
||||
public static EngineMainMCore get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// REGISTER
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void setup()
|
||||
@Override
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return MCore.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
MCorePlayerLeaveEvent.player2event.clear();
|
||||
Bukkit.getPluginManager().registerEvents(this, MCore.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -315,4 +322,5 @@ public class InternalListener implements Listener
|
||||
pcoll.syncId(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -7,9 +7,9 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
@ -35,7 +35,7 @@ import com.massivecraft.mcore.util.Txt;
|
||||
* After that you get kicked when using an incorrect casing.
|
||||
*
|
||||
*/
|
||||
public class EngineOfflineCase implements Listener
|
||||
public class EngineOfflineCase extends EngineAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
@ -45,11 +45,20 @@ public class EngineOfflineCase implements Listener
|
||||
public static EngineOfflineCase get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SETUP
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void setup()
|
||||
@Override
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return MCore.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
this.lowerToCorrect.clear();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
@ -61,8 +70,6 @@ public class EngineOfflineCase implements Listener
|
||||
{
|
||||
this.registerCase(pdname);
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, MCore.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -71,10 +78,6 @@ public class EngineOfflineCase implements Listener
|
||||
|
||||
private Map<String, String> lowerToCorrect = new HashMap<String, String>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
|
||||
private void registerCase(String playerName)
|
||||
{
|
||||
this.lowerToCorrect.put(playerName.toLowerCase(), playerName);
|
||||
|
@ -8,11 +8,11 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class EngineWorldNameSet implements Listener
|
||||
public class EngineWorldNameSet extends EngineAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
@ -22,18 +22,25 @@ public class EngineWorldNameSet implements Listener
|
||||
public static EngineWorldNameSet get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SETUP
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void setup()
|
||||
@Override
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return MCore.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate()
|
||||
{
|
||||
super.activate();
|
||||
|
||||
this.worldNamesInner.clear();
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
this.worldNamesInner.add(world.getName());
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, MCore.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -82,6 +82,4 @@ public final class HeatData
|
||||
return valueOf(heatTarget, now);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.mcore;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
@ -18,18 +19,19 @@ import com.massivecraft.mcore.adapter.JsonElementAdapter;
|
||||
import com.massivecraft.mcore.adapter.ObjectIdAdapter;
|
||||
import com.massivecraft.mcore.adapter.PlayerInventoryAdapter;
|
||||
import com.massivecraft.mcore.adapter.UUIDAdapter;
|
||||
import com.massivecraft.mcore.cmd.MCoreBukkitSimpleCommandMap;
|
||||
import com.massivecraft.mcore.integration.protocollib.ProtocolLibFeatures;
|
||||
import com.massivecraft.mcore.integration.vault.VaultFeatures;
|
||||
import com.massivecraft.mcore.mcorecmd.CmdMCore;
|
||||
import com.massivecraft.mcore.mcorecmd.CmdMCoreMStore;
|
||||
import com.massivecraft.mcore.mcorecmd.CmdMCoreUsys;
|
||||
import com.massivecraft.mcore.mixin.SenderIdMixinDefault;
|
||||
import com.massivecraft.mcore.mixin.TeleportMixinCauseEngine;
|
||||
import com.massivecraft.mcore.mixin.EngineTeleportMixinCause;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
import com.massivecraft.mcore.ps.PSAdapter;
|
||||
import com.massivecraft.mcore.store.Coll;
|
||||
import com.massivecraft.mcore.store.ExamineThread;
|
||||
import com.massivecraft.mcore.teleport.ScheduledTeleportEngine;
|
||||
import com.massivecraft.mcore.teleport.EngineScheduledTeleport;
|
||||
import com.massivecraft.mcore.util.PlayerUtil;
|
||||
import com.massivecraft.mcore.util.TimeDiffUtil;
|
||||
import com.massivecraft.mcore.util.TimeUnit;
|
||||
@ -147,37 +149,40 @@ public class MCore extends MPlugin
|
||||
SenderIdMixinDefault.get().setup();
|
||||
|
||||
// Register events
|
||||
InternalListener.get().setup();
|
||||
ScheduledTeleportEngine.get().setup();
|
||||
TeleportMixinCauseEngine.get().setup();
|
||||
EngineWorldNameSet.get().setup();
|
||||
EngineOfflineCase.get().setup();
|
||||
EngineMainMCore.get().activate();
|
||||
EngineScheduledTeleport.get().activate();
|
||||
EngineTeleportMixinCause.get().activate();
|
||||
EngineWorldNameSet.get().activate();
|
||||
EngineOfflineCase.get().activate(); // TODO: Make all engines
|
||||
PlayerUtil.get().setup();
|
||||
|
||||
// Schedule the collection ticker.
|
||||
// Tasks
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, this.collTickTask, 1, 1);
|
||||
|
||||
// Initialize Internal Collections
|
||||
// Collections
|
||||
MultiverseColl.get().init();
|
||||
AspectColl.get().init();
|
||||
MCoreConfColl.get().init();
|
||||
|
||||
// Init aspects
|
||||
// Aspects
|
||||
this.moneyAspect = AspectColl.get().get("mcore_money", true);
|
||||
this.moneyAspect.register();
|
||||
this.moneyAspect.setDesc(
|
||||
"<i>The aspect used for how much money a player has"
|
||||
);
|
||||
|
||||
// Inject our command map with dynamic tweaks
|
||||
MCoreBukkitSimpleCommandMap.inject();
|
||||
|
||||
// Register commands
|
||||
this.outerCmdMCore = new CmdMCore(ConfServer.aliasesOuterMCore);
|
||||
this.outerCmdMCore.register(this);
|
||||
this.outerCmdMCore = new CmdMCore() { public List<String> getAliases() { return MCoreConf.get().aliasesOuterMCore; } };
|
||||
this.outerCmdMCore.register();
|
||||
|
||||
this.outerCmdMCoreUsys = new CmdMCoreUsys(ConfServer.aliasesOuterMCoreUsys);
|
||||
this.outerCmdMCoreUsys.register(this);
|
||||
this.outerCmdMCoreUsys = new CmdMCoreUsys() { public List<String> getAliases() { return MCoreConf.get().aliasesOuterMCoreUsys; } };
|
||||
this.outerCmdMCoreUsys.register();
|
||||
|
||||
this.outerCmdMCoreMStore = new CmdMCoreMStore(ConfServer.aliasesOuterMCoreMStore);
|
||||
this.outerCmdMCoreMStore.register(this);
|
||||
this.outerCmdMCoreMStore = new CmdMCoreMStore() { public List<String> getAliases() { return MCoreConf.get().aliasesOuterMCoreMStore; } };
|
||||
this.outerCmdMCoreMStore.register();
|
||||
|
||||
// Integration
|
||||
this.integrate(
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.mcore;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.permissions.Permissible;
|
||||
@ -18,24 +19,16 @@ public class MCoreConf extends Entity<MCoreConf>
|
||||
protected static transient MCoreConf i;
|
||||
public static MCoreConf get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public MCoreConf load(MCoreConf that)
|
||||
{
|
||||
this.usingRecipientChatEvent = that.usingRecipientChatEvent;
|
||||
this.forcingOnePlayerNameCase = that.forcingOnePlayerNameCase;
|
||||
this.permissionDeniedFormats = that.permissionDeniedFormats;
|
||||
this.permissionToTpdelay = that.permissionToTpdelay;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public List<String> aliasesOuterMCore = MUtil.list("mcore");
|
||||
|
||||
public List<String> aliasesOuterMCoreUsys = MUtil.list("usys");
|
||||
|
||||
public List<String> aliasesOuterMCoreMStore = MUtil.list("mstore");
|
||||
|
||||
// These getters and setters are obnoxious, defensive copying, NPE avoiding and probably thread safe.
|
||||
|
||||
private boolean usingRecipientChatEvent = true;
|
||||
|
@ -38,6 +38,9 @@ public abstract class MPlugin extends JavaPlugin implements Listener
|
||||
// Create Gson
|
||||
this.gson = this.getGsonBuilder().create();
|
||||
|
||||
// Listener
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -160,4 +160,5 @@ public class Progressbar
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -93,4 +93,3 @@ public class SimpleConfig
|
||||
DiscUtil.writeCatch(file, content);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,5 +81,4 @@ public class Triple<A, B, C> implements Cloneable, Serializable
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -141,4 +141,5 @@ public class FireworkEffectAdapter
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,4 +60,5 @@ public class ObjectIdAdapter implements JsonDeserializer<ObjectId>, JsonSerializ
|
||||
{
|
||||
return convertStringToObjectId(jsonElement.getAsString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -70,4 +70,5 @@ public class PolymorphicAdapter<T> implements JsonDeserializer<T>, JsonSerialize
|
||||
}
|
||||
return context.deserialize(jsonObject.get(VALUE), typeClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,4 +76,5 @@ public class PotionEffectAdapter
|
||||
|
||||
return new PotionEffect(pet, duration, amplifier, ambient);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,4 +59,5 @@ public class UUIDAdapter implements JsonDeserializer<UUID>, JsonSerializer<UUID>
|
||||
{
|
||||
return convertStringToUUID(jsonElement.getAsString());
|
||||
}
|
||||
|
||||
}
|
||||
|
115
src/com/massivecraft/mcore/cmd/BukkitCommandDoor.java
Normal file
115
src/com/massivecraft/mcore/cmd/BukkitCommandDoor.java
Normal file
@ -0,0 +1,115 @@
|
||||
package com.massivecraft.mcore.cmd;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class BukkitCommandDoor
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// SINGLETON
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static CraftServer getCraftServer()
|
||||
{
|
||||
return (CraftServer)Bukkit.getServer();
|
||||
}
|
||||
|
||||
public static SimpleCommandMap getSimpleCommandMap()
|
||||
{
|
||||
return getCraftServer().getCommandMap();
|
||||
}
|
||||
|
||||
public static void setSimpleCommandMap(SimpleCommandMap simpleCommandMap)
|
||||
{
|
||||
set(CraftServer.class, "commandMap", getCraftServer(), simpleCommandMap);
|
||||
}
|
||||
|
||||
public static SimplePluginManager getSimplePluginManager()
|
||||
{
|
||||
return (SimplePluginManager)Bukkit.getPluginManager();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SIMPLE COMMAND MAP
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static Map<String, Command> getSimpleCommandMapDotKnownCommands(SimpleCommandMap simpleCommandMap)
|
||||
{
|
||||
return (Map<String, Command>) get(SimpleCommandMap.class, "knownCommands", simpleCommandMap);
|
||||
}
|
||||
|
||||
public static Set<String> getSimpleCommandMapDotAliases(SimpleCommandMap simpleCommandMap)
|
||||
{
|
||||
return (Set<String>) get(SimpleCommandMap.class, "aliases", simpleCommandMap);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SIMPLE PLUGIN MANAGER
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static CommandMap getSimplePluginManagerCommandMap(SimplePluginManager simplePluginManager)
|
||||
{
|
||||
return (CommandMap) get(SimplePluginManager.class, "commandMap", simplePluginManager);
|
||||
}
|
||||
|
||||
public static void setSimplePluginManagerCommandMap(SimplePluginManager simplePluginManager, CommandMap commandMap)
|
||||
{
|
||||
set(SimplePluginManager.class, "commandMap", simplePluginManager, commandMap);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// COMMAND
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static CommandMap getCommandDotCommandMap(Command command)
|
||||
{
|
||||
return (CommandMap) get(Command.class, "commandMap", command);
|
||||
}
|
||||
|
||||
public static void setCommandDotCommandMap(Command command, CommandMap commandMap)
|
||||
{
|
||||
set(Command.class, "commandMap", command, commandMap);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static Object get(Class<?> clazz, String fieldName, Object object)
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return field.get(object);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(Class<?> clazz, String fieldName, Object object, Object value)
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
field.set(object, value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package com.massivecraft.mcore.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.mcore.mixin.Mixin;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class BukkitGlueCommand extends Command
|
||||
{
|
||||
public final MCommand mcommand;
|
||||
public final Plugin plugin;
|
||||
|
||||
public BukkitGlueCommand(String name, MCommand mcommand, Plugin plugin)
|
||||
{
|
||||
super(name, mcommand.getDesc(), mcommand.getUseageTemplate(), new ArrayList<String>());
|
||||
this.mcommand = mcommand;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||
{
|
||||
if ( ! plugin.isEnabled()) return false;
|
||||
List<String> argList;
|
||||
if (this.mcommand.isUsingTokenizer())
|
||||
{
|
||||
argList = Txt.tokenizeArguments(Txt.implode(args, " "));
|
||||
}
|
||||
else
|
||||
{
|
||||
argList = new ArrayList<String>(Arrays.asList(args));
|
||||
}
|
||||
this.mcommand.execute(sender, argList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
|
||||
{
|
||||
List<String> superRet = super.tabComplete(sender, alias, args);
|
||||
if (args.length == 0) return superRet;
|
||||
|
||||
Set<String> ret = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
ret.addAll(superRet);
|
||||
|
||||
String tokenlc = args[args.length - 1].toLowerCase();
|
||||
|
||||
// Add ids of all online senders that match and isn't added yet.
|
||||
for (String senderId : Mixin.getOnlineSenderIds())
|
||||
{
|
||||
if (!senderId.toLowerCase().startsWith(tokenlc)) continue;
|
||||
if (!Mixin.canSee(sender, senderId)) continue;
|
||||
ret.add(senderId);
|
||||
}
|
||||
|
||||
return new ArrayList<String>(ret);
|
||||
}
|
||||
}
|
@ -8,19 +8,28 @@ import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class HelpCommand extends MCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static HelpCommand i = new HelpCommand();
|
||||
public static HelpCommand get() { return i; }
|
||||
private HelpCommand()
|
||||
{
|
||||
super();
|
||||
this.addAliases("?", "h", "help");
|
||||
this.setDesc("");
|
||||
this.addOptionalArg("page","1");
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
if (this.commandChain.size() == 0) return;
|
||||
MCommand parentCommand = this.commandChain.get(this.commandChain.size()-1);
|
||||
if (this.getCommandChain().size() == 0) return;
|
||||
MCommand parentCommand = this.getCommandChain().get(this.getCommandChain().size()-1);
|
||||
|
||||
ArrayList<String> lines = new ArrayList<String>();
|
||||
|
||||
@ -33,7 +42,7 @@ public class HelpCommand extends MCommand
|
||||
{
|
||||
if (subCommand.visibleTo(sender))
|
||||
{
|
||||
lines.add(subCommand.getUseageTemplate(this.commandChain, true, true, sender));
|
||||
lines.add(subCommand.getUseageTemplate(this.getCommandChain(), true, true, sender));
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,12 +51,4 @@ public class HelpCommand extends MCommand
|
||||
sendMessage(Txt.getPage(lines, pagenumber, "Help for command \""+parentCommand.getAliases().get(0)+"\"", sender));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static HelpCommand i = new HelpCommand();
|
||||
public static HelpCommand getInstance() { return i; }
|
||||
public static HelpCommand get() { return i; }
|
||||
|
||||
}
|
||||
|
@ -3,11 +3,9 @@ package com.massivecraft.mcore.cmd;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.mcore.Lang;
|
||||
import com.massivecraft.mcore.MCore;
|
||||
@ -16,11 +14,10 @@ import com.massivecraft.mcore.cmd.arg.ArgResult;
|
||||
import com.massivecraft.mcore.cmd.req.Req;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.mixin.Mixin;
|
||||
import com.massivecraft.mcore.util.BukkitCommandUtil;
|
||||
import com.massivecraft.mcore.util.PermUtil;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public abstract class MCommand
|
||||
public class MCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// COMMAND BEHAVIOR
|
||||
@ -116,7 +113,7 @@ public abstract class MCommand
|
||||
{
|
||||
if (this.descPermission != null) return this.descPermission;
|
||||
// Otherwise we try to find one.
|
||||
for (Req req : this.requirements)
|
||||
for (Req req : this.getRequirements())
|
||||
{
|
||||
if ( ! (req instanceof ReqHasPerm)) continue;
|
||||
return ((ReqHasPerm)req).getPerm();
|
||||
@ -161,46 +158,13 @@ public abstract class MCommand
|
||||
// BUKKIT INTEGRATION
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean register()
|
||||
protected final MCoreBukkitCommand bukkitCommand = new MCoreBukkitCommand(this);
|
||||
public MCoreBukkitCommand getBukkitCommand() { return this.bukkitCommand; }
|
||||
|
||||
public void register()
|
||||
{
|
||||
return register(MCore.get(), true);
|
||||
}
|
||||
|
||||
public boolean register(Plugin plugin)
|
||||
{
|
||||
return this.register(plugin, true);
|
||||
}
|
||||
|
||||
public boolean register(boolean override)
|
||||
{
|
||||
return this.register(MCore.get(), override);
|
||||
}
|
||||
|
||||
public boolean register(Plugin plugin, boolean override)
|
||||
{
|
||||
boolean ret = false;
|
||||
|
||||
SimpleCommandMap scm = BukkitCommandUtil.getBukkitCommandMap();
|
||||
|
||||
for (String alias : this.getAliases())
|
||||
{
|
||||
BukkitGlueCommand bgc = new BukkitGlueCommand(alias, this, plugin);
|
||||
|
||||
if (override)
|
||||
{
|
||||
// Our commands are more important than your commands :P
|
||||
Map<String, Command> knownCommands = BukkitCommandUtil.getKnownCommandsFromSimpleCommandMap(scm);
|
||||
String lowerLabel = bgc.getName().trim().toLowerCase();
|
||||
knownCommands.remove(lowerLabel);
|
||||
}
|
||||
|
||||
if (scm.register(MCore.get().getDescription().getName(), bgc))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
SimpleCommandMap scm = BukkitCommandDoor.getSimpleCommandMap();
|
||||
scm.register(MCore.get().getDescription().getName(), this.getBukkitCommand());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -209,9 +173,8 @@ public abstract class MCommand
|
||||
|
||||
public MCommand()
|
||||
{
|
||||
this.descPermission = null;
|
||||
|
||||
this.subCommands = new ArrayList<MCommand>();
|
||||
|
||||
this.aliases = new ArrayList<String>();
|
||||
|
||||
this.requiredArgs = new ArrayList<String>();
|
||||
@ -223,6 +186,7 @@ public abstract class MCommand
|
||||
this.usingTokenizer = true;
|
||||
|
||||
this.desc = null;
|
||||
this.descPermission = null;
|
||||
|
||||
this.visibilityMode = VisibilityMode.VISIBLE;
|
||||
}
|
||||
@ -242,15 +206,15 @@ public abstract class MCommand
|
||||
|
||||
this.fixSenderVars();
|
||||
|
||||
this.args = args;
|
||||
this.commandChain = commandChain;
|
||||
this.setArgs(args);
|
||||
this.setCommandChain(commandChain);
|
||||
|
||||
// Is there a matching sub command?
|
||||
if (args.size() > 0 )
|
||||
{
|
||||
for (MCommand subCommand: this.subCommands)
|
||||
for (MCommand subCommand: this.getSubCommands())
|
||||
{
|
||||
if (subCommand.aliases.contains(args.get(0)))
|
||||
if (subCommand.getAliases().contains(args.get(0)))
|
||||
{
|
||||
args.remove(0);
|
||||
commandChain.add(this);
|
||||
@ -260,7 +224,7 @@ public abstract class MCommand
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! validCall(this.sender, this.args)) return;
|
||||
if ( ! validCall(this.sender, this.getArgs())) return;
|
||||
|
||||
perform();
|
||||
}
|
||||
@ -273,8 +237,12 @@ public abstract class MCommand
|
||||
}
|
||||
|
||||
// This is where the command action is performed.
|
||||
public abstract void perform();
|
||||
|
||||
public void perform()
|
||||
{
|
||||
// Per default we just act as the help command!
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.get().execute(this.sender, this.getArgs(), this.getCommandChain());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CALL VALIDATION
|
||||
@ -323,7 +291,7 @@ public abstract class MCommand
|
||||
|
||||
public boolean validArgs(List<String> args, CommandSender sender)
|
||||
{
|
||||
if (args.size() < this.requiredArgs.size())
|
||||
if (args.size() < this.getRequiredArgs().size())
|
||||
{
|
||||
if (sender != null)
|
||||
{
|
||||
@ -333,12 +301,12 @@ public abstract class MCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.size() > this.requiredArgs.size() + this.optionalArgs.size() && this.errorOnToManyArgs)
|
||||
if (args.size() > this.getRequiredArgs().size() + this.getOptionalArgs().size() && this.getErrorOnToManyArgs())
|
||||
{
|
||||
if (sender != null)
|
||||
{
|
||||
// Get the to many string slice
|
||||
List<String> theToMany = args.subList(this.requiredArgs.size() + this.optionalArgs.size(), args.size());
|
||||
List<String> theToMany = args.subList(this.getRequiredArgs().size() + this.optionalArgs.size(), args.size());
|
||||
msg(Lang.COMMAND_TO_MANY_ARGS, Txt.implodeCommaAndDot(theToMany, Txt.parse("<aqua>%s"), Txt.parse("<b>, "), Txt.parse("<b> and "), ""));
|
||||
msg(Lang.COMMAND_TO_MANY_ARGS2);
|
||||
sender.sendMessage(this.getUseageTemplate());
|
||||
@ -385,11 +353,11 @@ public abstract class MCommand
|
||||
|
||||
if (first && onlyFirstAlias)
|
||||
{
|
||||
ret.append(mc.aliases.get(0));
|
||||
ret.append(mc.getAliases().get(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.append(Txt.implode(mc.aliases, ","));
|
||||
ret.append(Txt.implode(mc.getAliases(), ","));
|
||||
}
|
||||
|
||||
if (iter.hasNext())
|
||||
@ -402,12 +370,12 @@ public abstract class MCommand
|
||||
|
||||
List<String> args = new ArrayList<String>();
|
||||
|
||||
for (String requiredArg : this.requiredArgs)
|
||||
for (String requiredArg : this.getRequiredArgs())
|
||||
{
|
||||
args.add("<"+requiredArg+">");
|
||||
}
|
||||
|
||||
for (Entry<String, String> optionalArg : this.optionalArgs.entrySet())
|
||||
for (Entry<String, String> optionalArg : this.getOptionalArgs().entrySet())
|
||||
{
|
||||
String val = optionalArg.getValue();
|
||||
if (val == null)
|
||||
@ -516,7 +484,7 @@ public abstract class MCommand
|
||||
public String arg(int idx)
|
||||
{
|
||||
if ( ! this.argIsSet(idx)) return null;
|
||||
return this.args.get(idx);
|
||||
return this.getArgs().get(idx);
|
||||
}
|
||||
|
||||
public <T> T arg(int idx, ArgReader<T> argReader)
|
||||
@ -537,9 +505,9 @@ public abstract class MCommand
|
||||
{
|
||||
if ( ! this.argIsSet(idx)) return null;
|
||||
int from = idx;
|
||||
int to = args.size();
|
||||
int to = this.getArgs().size();
|
||||
if (to <= from) return "";
|
||||
return Txt.implode(this.args.subList(from, to), " ");
|
||||
return Txt.implode(this.getArgs().subList(from, to), " ");
|
||||
}
|
||||
|
||||
public <T> T argConcatFrom(int idx, ArgReader<T> argReader)
|
||||
|
116
src/com/massivecraft/mcore/cmd/MCoreBukkitCommand.java
Normal file
116
src/com/massivecraft/mcore/cmd/MCoreBukkitCommand.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.massivecraft.mcore.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.mcore.mixin.Mixin;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class MCoreBukkitCommand extends Command
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final MCommand mcommand;
|
||||
public MCommand getMcommand() { return this.mcommand; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public MCoreBukkitCommand(MCommand mcommand)
|
||||
{
|
||||
super(
|
||||
mcommand.getClass().getSimpleName(), // The name field is final. MCommand aliases/names are not final so we simply use the class name.
|
||||
null, // Set description to null. Instead we override the getter.
|
||||
null, // Set usage to null. Instead we override the getter.
|
||||
new ArrayList<String>() // Set aliases to "null". Instead we override the getter.
|
||||
);
|
||||
|
||||
this.mcommand = mcommand;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE: GETTERS
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return this.getMcommand().getDesc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return this.getMcommand().getUseageTemplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAliases()
|
||||
{
|
||||
return this.getMcommand().getAliases();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel()
|
||||
{
|
||||
return this.getMcommand().getAliases().get(0);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE: EXECUTE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||
{
|
||||
List<String> argList;
|
||||
if (this.mcommand.isUsingTokenizer())
|
||||
{
|
||||
argList = Txt.tokenizeArguments(Txt.implode(args, " "));
|
||||
}
|
||||
else
|
||||
{
|
||||
argList = new ArrayList<String>(Arrays.asList(args));
|
||||
}
|
||||
|
||||
this.mcommand.execute(sender, argList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE: TAB COMPLETE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
|
||||
{
|
||||
List<String> superRet = super.tabComplete(sender, alias, args);
|
||||
if (args.length == 0) return superRet;
|
||||
|
||||
Set<String> ret = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
ret.addAll(superRet);
|
||||
|
||||
String tokenlc = args[args.length - 1].toLowerCase();
|
||||
|
||||
// Add ids of all online senders that match and isn't added yet.
|
||||
for (String senderId : Mixin.getOnlineSenderIds())
|
||||
{
|
||||
if (!senderId.toLowerCase().startsWith(tokenlc)) continue;
|
||||
if (!Mixin.canSee(sender, senderId)) continue;
|
||||
ret.add(senderId);
|
||||
}
|
||||
|
||||
return new ArrayList<String>(ret);
|
||||
}
|
||||
|
||||
}
|
110
src/com/massivecraft/mcore/cmd/MCoreBukkitSimpleCommandMap.java
Normal file
110
src/com/massivecraft/mcore/cmd/MCoreBukkitSimpleCommandMap.java
Normal file
@ -0,0 +1,110 @@
|
||||
package com.massivecraft.mcore.cmd;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
|
||||
|
||||
public class MCoreBukkitSimpleCommandMap extends SimpleCommandMap
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INJECT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static MCoreBukkitSimpleCommandMap get()
|
||||
{
|
||||
SimpleCommandMap ret = BukkitCommandDoor.getSimpleCommandMap();
|
||||
if (!(ret instanceof MCoreBukkitSimpleCommandMap)) return null;
|
||||
return (MCoreBukkitSimpleCommandMap) ret;
|
||||
}
|
||||
|
||||
public static boolean isInjected()
|
||||
{
|
||||
return get() != null;
|
||||
}
|
||||
|
||||
public static void inject()
|
||||
{
|
||||
if (isInjected()) return;
|
||||
MCoreBukkitSimpleCommandMap instance = new MCoreBukkitSimpleCommandMap();
|
||||
BukkitCommandDoor.setSimpleCommandMap(instance);
|
||||
BukkitCommandDoor.setSimplePluginManagerCommandMap(BukkitCommandDoor.getSimplePluginManager(), instance);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final LinkedHashSet<MCoreBukkitCommand> mcoreBukkitCommands = new LinkedHashSet<MCoreBukkitCommand>();
|
||||
public LinkedHashSet<MCoreBukkitCommand> getMCoreBukkitCommands() { return this.mcoreBukkitCommands; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public MCoreBukkitSimpleCommandMap(SimpleCommandMap simpleCommandMap)
|
||||
{
|
||||
// Trigger the super constructor
|
||||
super(Bukkit.getServer());
|
||||
|
||||
// Fetch non static collection content
|
||||
this.knownCommands.putAll(BukkitCommandDoor.getSimpleCommandMapDotKnownCommands(simpleCommandMap));
|
||||
this.aliases.addAll(BukkitCommandDoor.getSimpleCommandMapDotAliases(simpleCommandMap));
|
||||
|
||||
// Convert registrations
|
||||
for (Entry<String, Command> entry : this.knownCommands.entrySet())
|
||||
{
|
||||
Command command = entry.getValue();
|
||||
if (BukkitCommandDoor.getCommandDotCommandMap(command) == null) continue;
|
||||
BukkitCommandDoor.setCommandDotCommandMap(command, this);
|
||||
}
|
||||
}
|
||||
|
||||
public MCoreBukkitSimpleCommandMap()
|
||||
{
|
||||
this(BukkitCommandDoor.getSimpleCommandMap());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean register(String label, String fallbackPrefix, Command command)
|
||||
{
|
||||
// Bukkit
|
||||
if (!(command instanceof MCoreBukkitCommand))
|
||||
{
|
||||
return super.register(label, fallbackPrefix, command);
|
||||
}
|
||||
|
||||
// MCore
|
||||
command.register(this);
|
||||
this.getMCoreBukkitCommands().add((MCoreBukkitCommand)command);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command getCommand(String name)
|
||||
{
|
||||
// MCore
|
||||
for (MCoreBukkitCommand mbc : this.getMCoreBukkitCommands())
|
||||
{
|
||||
for (String alias : mbc.getAliases())
|
||||
{
|
||||
if (alias.equalsIgnoreCase(name))
|
||||
{
|
||||
return mbc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bukkit
|
||||
return super.getCommand(name);
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,10 @@ import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class VersionCommand extends MCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static final String NOT_SPECIFIED = Txt.parse("<em><silver>not specified");
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -85,6 +89,4 @@ public class VersionCommand extends MCommand
|
||||
sendMessage(Txt.parse("<pink>%s: <aqua>%s", Txt.upperCaseFirst(key), value == null ? NOT_SPECIFIED : value));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -31,4 +31,5 @@ public abstract class ARAbstractPrimitive<T> extends ArgReaderAbstract<T>
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,4 +45,5 @@ public abstract class ARAbstractSelect<T> extends ArgReaderAbstract<T>
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,4 +19,5 @@ public abstract class ReqAbstract implements Req, Serializable
|
||||
{
|
||||
return this.createErrorMessage(sender, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,4 +61,5 @@ public class ReqAnd extends ReqAbstract
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,4 +38,5 @@ public class ReqHasPerm extends ReqAbstract
|
||||
{
|
||||
return PermUtil.getDeniedMessage(this.perm);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,4 +43,5 @@ public class ReqIsntCertainSender extends ReqAbstract
|
||||
{
|
||||
return Txt.parse("<b>Player can't be <h>%s<b>.", Mixin.getDisplayName(this.getSenderId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,4 +49,5 @@ public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,4 +56,5 @@ public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public abstract class MCoreEvent extends Event implements Runnable, Cancellable
|
||||
|
||||
public MCoreEvent()
|
||||
{
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
public MCoreEvent(boolean isAsync)
|
||||
|
@ -33,4 +33,5 @@ public class MCorePermissionDeniedFormatEvent extends MCoreEvent
|
||||
this.permissionName = permissionName;
|
||||
this.format = null;
|
||||
}
|
||||
|
||||
}
|
@ -117,4 +117,5 @@ public class Integration implements Listener
|
||||
{
|
||||
this.tick();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,4 +42,5 @@ public abstract class IntegrationFeaturesAbstract implements IntegrationFeatures
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -84,4 +84,5 @@ public class EntityPotionColorPacketAdapter extends PacketAdapter
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,40 +1,38 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.HelpCommand;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.VersionCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
public class CmdMCore extends MCoreCommand
|
||||
public class CmdMCore extends MCommand
|
||||
{
|
||||
public CmdMCoreUsys cmdMCoreUsys = new CmdMCoreUsys(MUtil.list("usys"));
|
||||
public CmdMCoreMStore cmdMCoreMStore = new CmdMCoreMStore(MUtil.list("mstore"));
|
||||
public CmdMCoreId cmdMCoreId = new CmdMCoreId(MUtil.list("id"));
|
||||
public CmdMCoreHearsound cmdMCoreHearsound = new CmdMCoreHearsound(MUtil.list("hearsound", "hearsounds"));
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsys cmdMCoreUsys = new CmdMCoreUsys();
|
||||
public CmdMCoreMStore cmdMCoreMStore = new CmdMCoreMStore();
|
||||
public CmdMCoreId cmdMCoreId = new CmdMCoreId();
|
||||
public CmdMCoreHearsound cmdMCoreHearsound = new CmdMCoreHearsound();
|
||||
public VersionCommand cmdMCoreVersion = new VersionCommand(MCore.get(), MCorePerm.CMD_MCORE_VERSION.node, "v", "version");
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCore(List<String> aliases)
|
||||
public CmdMCore()
|
||||
{
|
||||
super(aliases);
|
||||
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMCoreUsys);
|
||||
this.addSubCommand(this.cmdMCoreMStore);
|
||||
this.addSubCommand(this.cmdMCoreId);
|
||||
this.addSubCommand(this.cmdMCoreHearsound);
|
||||
this.addSubCommand(this.cmdMCoreVersion);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
|
||||
}
|
||||
}
|
@ -4,24 +4,35 @@ import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.SoundEffect;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARSoundEffects;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
|
||||
|
||||
public class CmdMCoreHearsound extends MCoreCommand
|
||||
public class CmdMCoreHearsound extends MCommand
|
||||
{
|
||||
public CmdMCoreHearsound(List<String> aliases)
|
||||
{
|
||||
super(aliases);
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreHearsound()
|
||||
{
|
||||
// Aliases
|
||||
this.addAliases("hearsound", "hearsounds");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("sound(s)");
|
||||
|
||||
this.setErrorOnToManyArgs(false);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_HEARSOUND.node));
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
|
@ -1,22 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.ConfServer;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreId extends MCoreCommand
|
||||
public class CmdMCoreId extends MCommand
|
||||
{
|
||||
public CmdMCoreId(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreId()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("id");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_ID.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.msg("<i>The id of this server is \"<h>%s<i>\".", ConfServer.serverid);
|
||||
}
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
}
|
||||
|
@ -1,33 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.HelpCommand;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
public class CmdMCoreMStore extends MCoreCommand
|
||||
public class CmdMCoreMStore extends MCommand
|
||||
{
|
||||
public CmdMCoreMStoreStats cmdMCoreMStoreStats = new CmdMCoreMStoreStats(MUtil.list("stats"));
|
||||
public CmdMCoreMStoreListcolls cmdMCoreMStoreListcolls = new CmdMCoreMStoreListcolls(MUtil.list("listcolls"));
|
||||
public CmdMCoreMStoreCopydb cmdMCoreMStoreCopydb = new CmdMCoreMStoreCopydb(MUtil.list("copydb"));
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreMStore(List<String> aliases)
|
||||
public CmdMCoreMStoreStats cmdMCoreMStoreStats = new CmdMCoreMStoreStats();
|
||||
public CmdMCoreMStoreListcolls cmdMCoreMStoreListcolls = new CmdMCoreMStoreListcolls();
|
||||
public CmdMCoreMStoreCopydb cmdMCoreMStoreCopydb = new CmdMCoreMStoreCopydb();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreMStore()
|
||||
{
|
||||
super(aliases);
|
||||
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdMCoreMStoreStats);
|
||||
this.addSubCommand(this.cmdMCoreMStoreListcolls);
|
||||
this.addSubCommand(this.cmdMCoreMStoreCopydb);
|
||||
|
||||
// Args
|
||||
this.addAliases("mstore");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_MSTORE.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.store.Coll;
|
||||
import com.massivecraft.mcore.store.Db;
|
||||
@ -14,18 +14,29 @@ import com.massivecraft.mcore.store.Driver;
|
||||
import com.massivecraft.mcore.store.MStore;
|
||||
import com.massivecraft.mcore.xlib.gson.JsonElement;
|
||||
|
||||
public class CmdMCoreMStoreCopydb extends MCoreCommand
|
||||
public class CmdMCoreMStoreCopydb extends MCommand
|
||||
{
|
||||
public CmdMCoreMStoreCopydb(List<String> aliases)
|
||||
{
|
||||
super(aliases);
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreMStoreCopydb()
|
||||
{
|
||||
// Aliases
|
||||
this.addAliases("copydb");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("from");
|
||||
this.addRequiredArg("to");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_MSTORE_COPYDB.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.massivecraft.mcore.ConfServer;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.NaturalOrderComparator;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARString;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.store.Coll;
|
||||
@ -14,17 +14,28 @@ import com.massivecraft.mcore.store.Db;
|
||||
import com.massivecraft.mcore.store.MStore;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class CmdMCoreMStoreListcolls extends MCoreCommand
|
||||
public class CmdMCoreMStoreListcolls extends MCommand
|
||||
{
|
||||
public CmdMCoreMStoreListcolls(List<String> aliases)
|
||||
{
|
||||
super(aliases);
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreMStoreListcolls()
|
||||
{
|
||||
// Aliases
|
||||
this.addAliases("listcolls");
|
||||
|
||||
// Args
|
||||
this.addOptionalArg("db", ConfServer.dburi);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_MSTORE_LISTCOLLS.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARColl;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.store.Coll;
|
||||
@ -11,17 +11,28 @@ import com.massivecraft.mcore.store.ExamineThread;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class CmdMCoreMStoreStats extends MCoreCommand
|
||||
public class CmdMCoreMStoreStats extends MCommand
|
||||
{
|
||||
public CmdMCoreMStoreStats(List<String> aliases)
|
||||
{
|
||||
super(aliases);
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreMStoreStats()
|
||||
{
|
||||
// Aliases
|
||||
this.addAliases("stats");
|
||||
|
||||
// Args
|
||||
this.addOptionalArg("coll", Coll.TOTAL);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_MSTORE_STATS.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -82,4 +93,5 @@ public class CmdMCoreMStoreStats extends MCoreCommand
|
||||
msg("<k>%s <v>%d", entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,35 +1,37 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.HelpCommand;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
public class CmdMCoreUsys extends MCoreCommand
|
||||
public class CmdMCoreUsys extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysMultiverse cmdUsysMultiverse = new CmdMCoreUsysMultiverse(MUtil.list("m", "multiverse"));
|
||||
public CmdMCoreUsysUniverse cmdUsysUniverse = new CmdMCoreUsysUniverse(MUtil.list("u", "universe"));
|
||||
public CmdMCoreUsysWorld cmdUsysWorld = new CmdMCoreUsysWorld(MUtil.list("w", "world"));
|
||||
public CmdMCoreUsysAspect cmdUsysAspect = new CmdMCoreUsysAspect(MUtil.list("a", "aspect"));
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsys(List<String> aliases)
|
||||
public CmdMCoreUsysMultiverse cmdUsysMultiverse = new CmdMCoreUsysMultiverse();
|
||||
public CmdMCoreUsysUniverse cmdUsysUniverse = new CmdMCoreUsysUniverse();
|
||||
public CmdMCoreUsysWorld cmdUsysWorld = new CmdMCoreUsysWorld();
|
||||
public CmdMCoreUsysAspect cmdUsysAspect = new CmdMCoreUsysAspect();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsys()
|
||||
{
|
||||
super(aliases);
|
||||
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdUsysMultiverse);
|
||||
this.addSubCommand(this.cmdUsysUniverse);
|
||||
this.addSubCommand(this.cmdUsysWorld);
|
||||
this.addSubCommand(this.cmdUsysAspect);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("usys");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
|
||||
}
|
||||
}
|
@ -1,33 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.HelpCommand;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
public class CmdMCoreUsysAspect extends MCoreCommand
|
||||
public class CmdMCoreUsysAspect extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysAspectList cmdUsysAspectList = new CmdMCoreUsysAspectList(MUtil.list("l", "list"));
|
||||
public CmdMCoreUsysAspectShow cmdUsysAspectShow = new CmdMCoreUsysAspectShow(MUtil.list("s", "show"));
|
||||
public CmdMCoreUsysAspectUse cmdUsysAspectUse = new CmdMCoreUsysAspectUse(MUtil.list("u", "use"));
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysAspect(List<String> aliases)
|
||||
public CmdMCoreUsysAspectList cmdUsysAspectList = new CmdMCoreUsysAspectList();
|
||||
public CmdMCoreUsysAspectShow cmdUsysAspectShow = new CmdMCoreUsysAspectShow();
|
||||
public CmdMCoreUsysAspectUse cmdUsysAspectUse = new CmdMCoreUsysAspectUse();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysAspect()
|
||||
{
|
||||
super(aliases);
|
||||
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdUsysAspectList);
|
||||
this.addSubCommand(this.cmdUsysAspectShow);
|
||||
this.addSubCommand(this.cmdUsysAspectUse);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("a", "aspect");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_ASPECT.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
|
||||
}
|
||||
}
|
||||
|
@ -6,20 +6,33 @@ import java.util.List;
|
||||
import com.massivecraft.mcore.Aspect;
|
||||
import com.massivecraft.mcore.AspectColl;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class CmdMCoreUsysAspectList extends MCoreCommand
|
||||
public class CmdMCoreUsysAspectList extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysAspectList(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysAspectList()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("l", "list");
|
||||
|
||||
// Args
|
||||
this.addOptionalArg("page", "1");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_ASPECT_LIST.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -38,4 +51,5 @@ public class CmdMCoreUsysAspectList extends MCoreCommand
|
||||
lines = Txt.parseWrap(lines);
|
||||
this.sendMessage(Txt.getPage(lines, pageHumanBased, "Aspect List", sender));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,23 +1,34 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.Aspect;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARAspect;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class CmdMCoreUsysAspectShow extends MCoreCommand
|
||||
public class CmdMCoreUsysAspectShow extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysAspectShow(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysAspectShow()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("s", "show");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("aspect");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_ASPECT_SHOW.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -32,4 +43,5 @@ public class CmdMCoreUsysAspectShow extends MCoreCommand
|
||||
msg(descLine);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,25 +1,36 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.Aspect;
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARAspect;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysAspectUse extends MCoreCommand
|
||||
public class CmdMCoreUsysAspectUse extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysAspectUse(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysAspectUse()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("u", "use");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("aspect");
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_ASPECT_USE.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -33,4 +44,5 @@ public class CmdMCoreUsysAspectUse extends MCoreCommand
|
||||
|
||||
msg("<g>The aspect <h>%s<g> now use multiverse <h>%s<g>.", aspect.getId(), multiverse.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,35 +1,37 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.HelpCommand;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
public class CmdMCoreUsysMultiverse extends MCoreCommand
|
||||
public class CmdMCoreUsysMultiverse extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysMultiverseList cmdUsysMultiverseList = new CmdMCoreUsysMultiverseList(MUtil.list("l", "list"));
|
||||
public CmdMCoreUsysMultiverseShow cmdUsysMultiverseShow = new CmdMCoreUsysMultiverseShow(MUtil.list("s", "show"));
|
||||
public CmdMCoreUsysMultiverseNew cmdUsysMultiverseNew = new CmdMCoreUsysMultiverseNew(MUtil.list("n", "new"));
|
||||
public CmdMCoreUsysMultiverseDel cmdUsysMultiverseDel = new CmdMCoreUsysMultiverseDel(MUtil.list("d", "del"));
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysMultiverse(List<String> aliases)
|
||||
public CmdMCoreUsysMultiverseList cmdUsysMultiverseList = new CmdMCoreUsysMultiverseList();
|
||||
public CmdMCoreUsysMultiverseShow cmdUsysMultiverseShow = new CmdMCoreUsysMultiverseShow();
|
||||
public CmdMCoreUsysMultiverseNew cmdUsysMultiverseNew = new CmdMCoreUsysMultiverseNew();
|
||||
public CmdMCoreUsysMultiverseDel cmdUsysMultiverseDel = new CmdMCoreUsysMultiverseDel();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysMultiverse()
|
||||
{
|
||||
super(aliases);
|
||||
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdUsysMultiverseList);
|
||||
this.addSubCommand(this.cmdUsysMultiverseShow);
|
||||
this.addSubCommand(this.cmdUsysMultiverseNew);
|
||||
this.addSubCommand(this.cmdUsysMultiverseDel);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("m", "multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_MULTIVERSE.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,34 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysMultiverseDel extends MCoreCommand
|
||||
public class CmdMCoreUsysMultiverseDel extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysMultiverseDel(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysMultiverseDel()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("d", "del");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_MULTIVERSE_DEL.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -36,4 +47,5 @@ public class CmdMCoreUsysMultiverseDel extends MCoreCommand
|
||||
|
||||
msg("<g>Deleted multiverse <h>%s<g>.", id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,20 +6,33 @@ import java.util.List;
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MultiverseColl;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class CmdMCoreUsysMultiverseList extends MCoreCommand
|
||||
public class CmdMCoreUsysMultiverseList extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysMultiverseList(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysMultiverseList()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("l", "list");
|
||||
|
||||
// Args
|
||||
this.addOptionalArg("page", "1");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_MULTIVERSE_LIST.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -38,4 +51,5 @@ public class CmdMCoreUsysMultiverseList extends MCoreCommand
|
||||
lines = Txt.parseWrap(lines);
|
||||
this.sendMessage(Txt.getPage(lines, pageHumanBased, "Multiverse List", sender));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,32 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MultiverseColl;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysMultiverseNew extends MCoreCommand
|
||||
public class CmdMCoreUsysMultiverseNew extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysMultiverseNew(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysMultiverseNew()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("n", "new");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_MULTIVERSE_NEW.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -31,4 +42,5 @@ public class CmdMCoreUsysMultiverseNew extends MCoreCommand
|
||||
|
||||
msg("<g>Created multiverse <h>%s<g>.", id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,20 +7,33 @@ import com.massivecraft.mcore.Aspect;
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class CmdMCoreUsysMultiverseShow extends MCoreCommand
|
||||
public class CmdMCoreUsysMultiverseShow extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysMultiverseShow(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysMultiverseShow()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("s", "show");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_MULTIVERSE_SHOW.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -62,4 +75,5 @@ public class CmdMCoreUsysMultiverseShow extends MCoreCommand
|
||||
msg(Txt.implodeCommaAndDot(ids, "<h>%s", "<i>, ", " <i>and ", "<i>."));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,33 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.HelpCommand;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
|
||||
public class CmdMCoreUsysUniverse extends MCoreCommand
|
||||
public class CmdMCoreUsysUniverse extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysUniverseNew cmdUsysUniverseNew = new CmdMCoreUsysUniverseNew(MUtil.list("n", "new"));
|
||||
public CmdMCoreUsysUniverseDel cmdUsysUniverseDel = new CmdMCoreUsysUniverseDel(MUtil.list("d", "del"));
|
||||
public CmdMCoreUsysUniverseClear cmdUsysUniverseClear = new CmdMCoreUsysUniverseClear(MUtil.list("c", "clear"));
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysUniverse(List<String> aliases)
|
||||
public CmdMCoreUsysUniverseNew cmdUsysUniverseNew = new CmdMCoreUsysUniverseNew();
|
||||
public CmdMCoreUsysUniverseDel cmdUsysUniverseDel = new CmdMCoreUsysUniverseDel();
|
||||
public CmdMCoreUsysUniverseClear cmdUsysUniverseClear = new CmdMCoreUsysUniverseClear();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysUniverse()
|
||||
{
|
||||
super(aliases);
|
||||
|
||||
// SubCommands
|
||||
this.addSubCommand(this.cmdUsysUniverseNew);
|
||||
this.addSubCommand(this.cmdUsysUniverseDel);
|
||||
this.addSubCommand(this.cmdUsysUniverseClear);
|
||||
|
||||
// Aliases
|
||||
this.addAliases("u", "universe");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_UNIVERSE.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
this.getCommandChain().add(this);
|
||||
HelpCommand.getInstance().execute(this.sender, this.args, this.commandChain);
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysUniverseClear extends MCoreCommand
|
||||
public class CmdMCoreUsysUniverseClear extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysUniverseClear(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysUniverseClear()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("c", "clear");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("universe");
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_UNIVERSE_CLEAR.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -43,4 +54,5 @@ public class CmdMCoreUsysUniverseClear extends MCoreCommand
|
||||
msg("<b>No universe <h>%s<b> exists in multiverse <h>%s<b>.", universe, multiverse.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,24 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysUniverseDel extends MCoreCommand
|
||||
public class CmdMCoreUsysUniverseDel extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysUniverseDel(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysUniverseDel()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("d", "del");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("universe");
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_MULTIVERSE_DEL.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -44,4 +55,5 @@ public class CmdMCoreUsysUniverseDel extends MCoreCommand
|
||||
|
||||
msg("<g>Deleted universe <h>%s<g> in multiverse <h>%s<g>.", universe, multiverse.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,23 +1,34 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysUniverseNew extends MCoreCommand
|
||||
public class CmdMCoreUsysUniverseNew extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysUniverseNew(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysUniverseNew()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("n", "new");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("universe");
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_UNIVERSE_NEW.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -36,4 +47,5 @@ public class CmdMCoreUsysUniverseNew extends MCoreCommand
|
||||
|
||||
msg("<g>Created universe <h>%s<g> in multiverse <h>%s<g>.", universe, multiverse.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,24 +1,35 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.Multiverse;
|
||||
import com.massivecraft.mcore.MCorePerm;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.arg.ARMultiverse;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdMCoreUsysWorld extends MCoreCommand
|
||||
public class CmdMCoreUsysWorld extends MCommand
|
||||
{
|
||||
public CmdMCoreUsysWorld(List<String> aliases)
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdMCoreUsysWorld()
|
||||
{
|
||||
super(aliases);
|
||||
// Aliases
|
||||
this.addAliases("w", "world");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("world");
|
||||
this.addRequiredArg("universe");
|
||||
this.addRequiredArg("multiverse");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(MCorePerm.CMD_MCORE_USYS_WORLD.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
@ -45,4 +56,5 @@ public class CmdMCoreUsysWorld extends MCoreCommand
|
||||
msg("<i>World <h>%s <i>is already in universe <h>%s <i>in multiverse <h>%s<i>.", worldName, universe, multiverse.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
package com.massivecraft.mcore.mcorecmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
|
||||
public abstract class MCoreCommand extends MCommand
|
||||
{
|
||||
public MCoreCommand(List<String> aliases)
|
||||
{
|
||||
this.setAliases(aliases);
|
||||
}
|
||||
}
|
@ -7,28 +7,30 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.mcore.EngineAbstract;
|
||||
import com.massivecraft.mcore.MCore;
|
||||
|
||||
public class TeleportMixinCauseEngine implements Listener
|
||||
public class EngineTeleportMixinCause extends EngineAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static TeleportMixinCauseEngine i = new TeleportMixinCauseEngine();
|
||||
public static TeleportMixinCauseEngine get() { return i; }
|
||||
public TeleportMixinCauseEngine() {}
|
||||
private static EngineTeleportMixinCause i = new EngineTeleportMixinCause();
|
||||
public static EngineTeleportMixinCause get() { return i; }
|
||||
public EngineTeleportMixinCause() {}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SETUP
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void setup()
|
||||
@Override
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(this, MCore.get());
|
||||
return MCore.get();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
@ -30,7 +30,7 @@ public abstract class TeleportMixinAbstract implements TeleportMixin
|
||||
@Override
|
||||
public boolean isCausedByMixin(PlayerTeleportEvent event)
|
||||
{
|
||||
return TeleportMixinCauseEngine.get().isCausedByTeleportMixin(event);
|
||||
return EngineTeleportMixinCause.get().isCausedByTeleportMixin(event);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -49,9 +49,9 @@ public class TeleportMixinDefault extends TeleportMixinAbstract
|
||||
if (vehicle != null) vehicle.eject();
|
||||
|
||||
// Do the teleport
|
||||
TeleportMixinCauseEngine.get().setMixinCausedTeleportIncoming(true);
|
||||
EngineTeleportMixinCause.get().setMixinCausedTeleportIncoming(true);
|
||||
player.teleport(location);
|
||||
TeleportMixinCauseEngine.get().setMixinCausedTeleportIncoming(false);
|
||||
EngineTeleportMixinCause.get().setMixinCausedTeleportIncoming(false);
|
||||
|
||||
// Bukkit velocity
|
||||
Vector velocity = null;
|
||||
|
@ -6,7 +6,7 @@ public class TeleporterException extends Exception
|
||||
|
||||
public TeleporterException()
|
||||
{
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
public TeleporterException(String message)
|
||||
|
@ -90,6 +90,11 @@ public class MStore
|
||||
return db;
|
||||
}
|
||||
|
||||
public static Db getDb()
|
||||
{
|
||||
return getDb(ConfServer.dburi);
|
||||
}
|
||||
|
||||
public static Db getDb(URI uri)
|
||||
{
|
||||
String scheme = uri.getScheme();
|
||||
|
@ -17,4 +17,5 @@ public final class Accessor
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -171,5 +171,4 @@ public class AccessorUtil
|
||||
return new PropertyAccessorComposite(getter, setter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,4 +48,5 @@ public abstract class EntityAccessorAbstract implements EntityAccessor
|
||||
{
|
||||
this.copy(from, to, DEFAULT_TRANSPARENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,4 +82,5 @@ public class EntityAccessorPerProperty extends EntityAccessorAbstract
|
||||
{
|
||||
return this.propertyAccessors.keySet();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,4 +22,5 @@ public class PropertyAccessorComposite implements PropertyAccessor
|
||||
{
|
||||
return this.getter.get(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,25 +3,25 @@ package com.massivecraft.mcore.teleport;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.mcore.EngineAbstract;
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.mixin.Mixin;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
|
||||
public class ScheduledTeleportEngine implements Listener, Runnable
|
||||
public class EngineScheduledTeleport extends EngineAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ScheduledTeleportEngine i = new ScheduledTeleportEngine();
|
||||
public static ScheduledTeleportEngine get() { return i; }
|
||||
private static EngineScheduledTeleport i = new EngineScheduledTeleport();
|
||||
public static EngineScheduledTeleport get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SCHEDULED TELEPORT INDEX
|
||||
@ -56,13 +56,32 @@ public class ScheduledTeleportEngine implements Listener, Runnable
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SETUP
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void setup()
|
||||
@Override
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(this, MCore.get());
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(MCore.get(), this, 1, 1);
|
||||
return MCore.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getPeriod()
|
||||
{
|
||||
return 1L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
for (ScheduledTeleport st : teleporteeIdToScheduledTeleport.values())
|
||||
{
|
||||
if (st.isDue(now))
|
||||
{
|
||||
st.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -86,21 +105,4 @@ public class ScheduledTeleportEngine implements Listener, Runnable
|
||||
Mixin.msg(scheduledTeleport.getTeleporteeId(), "<rose>Cancelled <i>teleport to <h>"+scheduledTeleport.getDestinationDesc()+"<i>.");
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// LISTENER
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
for (ScheduledTeleport st : teleporteeIdToScheduledTeleport.values())
|
||||
{
|
||||
if (st.isDue(now))
|
||||
{
|
||||
st.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -45,17 +45,17 @@ public class ScheduledTeleport implements Runnable
|
||||
|
||||
public boolean isScheduled()
|
||||
{
|
||||
return ScheduledTeleportEngine.get().isScheduled(this);
|
||||
return EngineScheduledTeleport.get().isScheduled(this);
|
||||
}
|
||||
|
||||
public ScheduledTeleport schedule()
|
||||
{
|
||||
return ScheduledTeleportEngine.get().schedule(this);
|
||||
return EngineScheduledTeleport.get().schedule(this);
|
||||
}
|
||||
|
||||
public boolean unschedule()
|
||||
{
|
||||
return ScheduledTeleportEngine.get().unschedule(this);
|
||||
return EngineScheduledTeleport.get().unschedule(this);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -63,4 +63,5 @@ public class BiomeUtil
|
||||
{
|
||||
return getBiomeIdAndNameAt(world, x, z).getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
package com.massivecraft.mcore.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
|
||||
public class BukkitCommandUtil
|
||||
{
|
||||
public static SimpleCommandMap getBukkitCommandMap()
|
||||
{
|
||||
CraftServer craftServer = (CraftServer)Bukkit.getServer();
|
||||
return craftServer.getCommandMap();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map<String, Command> getKnownCommandsFromSimpleCommandMap(SimpleCommandMap scm)
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = SimpleCommandMap.class.getDeclaredField("knownCommands");
|
||||
field.setAccessible(true);
|
||||
return (Map<String, Command>) field.get(scm);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -47,4 +47,5 @@ public class ClassLoadHack
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -10,6 +10,7 @@ public class IntervalUtil
|
||||
// -------------------------------------------- //
|
||||
// PARSING SIMPLE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static Double parseDouble(String str, Double def)
|
||||
{
|
||||
if (str == null) return def;
|
||||
@ -144,4 +145,5 @@ public class IntervalUtil
|
||||
return parseInteger(data, def);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryPlayer;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
@ -25,19 +26,21 @@ public class InventoryUtil
|
||||
// -------------------------------------------- //
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void update(Player player)
|
||||
public static void update(HumanEntity human)
|
||||
{
|
||||
if (!(human instanceof Player)) return;
|
||||
Player player = (Player)human;
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
public static void updateSoon(final Player player)
|
||||
public static void updateSoon(final HumanEntity human)
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MCore.get(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
update(player);
|
||||
update(human);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -40,4 +40,5 @@ public class LibLoader
|
||||
{
|
||||
return new File("./lib/"+filename);
|
||||
}
|
||||
|
||||
}
|
@ -38,4 +38,5 @@ public class LightUtil
|
||||
WorldServer worldServer = cworld.getHandle();
|
||||
worldServer.A(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.massivecraft.mcore.InternalListener;
|
||||
import com.massivecraft.mcore.EngineMainMCore;
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.EngineWorldNameSet;
|
||||
import com.massivecraft.mcore.util.extractor.Extractor;
|
||||
@ -291,7 +291,7 @@ public class MUtil
|
||||
|
||||
public static String kickReason(PlayerQuitEvent event)
|
||||
{
|
||||
return InternalListener.kickedPlayerReasons.get(event.getPlayer().getName());
|
||||
return EngineMainMCore.kickedPlayerReasons.get(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
public static boolean causedByKick(PlayerQuitEvent event)
|
||||
@ -647,4 +647,5 @@ public class MUtil
|
||||
registerExtractor(String.class, "moneyUniverse", ExtractorMoneyUniverse.get());
|
||||
registerExtractor(String.class, "accountId", ExtractorPlayerName.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -395,4 +395,5 @@ public class PermUtil
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,4 +104,5 @@ public class TextWrapper
|
||||
// Return it split
|
||||
return out.toString().split("\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user