1.0h Click command

This commit is contained in:
BuildTools 2016-03-15 22:15:57 +01:00 committed by Olof Larsson
parent f457aafbe0
commit 301c5a766b
6 changed files with 71 additions and 1 deletions

View File

@ -41,6 +41,7 @@ permissions:
massivecore.buffer.add: {description: add to buffer, default: false}
massivecore.buffer.whitespace: {description: add whitespace to buffer, default: false}
massivecore.cmdurl: {description: run all lines of url content, default: false}
massivecore.click: {description: click, default: false}
# misc
massivecore.notpdelay: {description: teleport without delay, default: false}
massivecore.variable.book: {description: replace ***book*** with content of book in your hand, default: false}
@ -82,6 +83,7 @@ permissions:
massivecore.buffer.add: true
massivecore.buffer.whitespace: true
massivecore.cmdurl: true
massivecore.click: true
massivecore.notpdelay: true
massivecore.variable.book: true
massivecore.variable.buffer: true
@ -129,6 +131,7 @@ permissions:
children:
massivecore.basecommand: true
massivecore.hearsound: true
massivecore.click: true
massivecore.version: true
massivecore.kit.default:
default: true

View File

@ -41,6 +41,7 @@ import com.massivecraft.massivecore.collections.MassiveTreeSet;
import com.massivecraft.massivecore.collections.MassiveTreeSetDef;
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCore;
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreBuffer;
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreClick;
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreCmdurl;
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreStore;
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreUsys;
@ -218,7 +219,8 @@ public class MassiveCore extends MassivePlugin
CmdMassiveCoreUsys.get(),
CmdMassiveCoreStore.get(),
CmdMassiveCoreBuffer.get(),
CmdMassiveCoreCmdurl.get()
CmdMassiveCoreCmdurl.get(),
CmdMassiveCoreClick.get()
);
// Start the examine threads

View File

@ -88,12 +88,22 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnDelete);
}
// -------------------------------------------- //
// VARIABLES
// -------------------------------------------- //
public String variableBook = "***book***";
public boolean usingVariableBook = true;
public String variableBuffer = "***buffer***";
public boolean usingVariableBuffer = true;
// -------------------------------------------- //
// CLICK COMMAND
// -------------------------------------------- //
public SoundEffect commandClickSound = SoundEffect.valueOf("UI_BUTTON_CLICK", 1.0f, 1.0f);
// -------------------------------------------- //
// MSTORE CONFIGURATON
// -------------------------------------------- //
@ -103,4 +113,5 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
public boolean warnOnLocalAlter = false;
}

View File

@ -44,6 +44,7 @@ public enum MassiveCorePerm
NOTPDELAY("notpdelay"),
VARIABLE_BOOK("variable.book"),
VARIABLE_BUFFER("variable.buffer"),
CLICK("click"),
// END OF LIST
;

View File

@ -29,6 +29,7 @@ public class CmdMassiveCore extends MassiveCommand
public CmdMassiveCoreHearsound cmdMassiveCoreHearsound = new CmdMassiveCoreHearsound();
public CmdMassiveCoreBuffer cmdMassiveCoreBuffer = new CmdMassiveCoreBuffer();
public CmdMassiveCoreCmdurl cmdMassiveCoreCmdurl = new CmdMassiveCoreCmdurl();
public CmdMassiveCoreClick cmdMassiveCoreClick = new CmdMassiveCoreClick();
public MassiveCommandVersion cmdMassiveCoreVersion = new MassiveCommandVersion(MassiveCore.get(), MassiveCorePerm.VERSION.node, "v", "version");
// -------------------------------------------- //
@ -45,6 +46,7 @@ public class CmdMassiveCore extends MassiveCommand
this.addChild(this.cmdMassiveCoreHearsound);
this.addChild(this.cmdMassiveCoreBuffer);
this.addChild(this.cmdMassiveCoreCmdurl);
this.addChild(this.cmdMassiveCoreClick);
this.addChild(this.cmdMassiveCoreVersion);
// Requirements

View File

@ -0,0 +1,51 @@
package com.massivecraft.massivecore.command.massivecore;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.TypeStringCommand;
import com.massivecraft.massivecore.mixin.Mixin;
public class CmdMassiveCoreClick extends MassiveCommand
{
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
private static CmdMassiveCoreClick i = new CmdMassiveCoreClick();
public static CmdMassiveCoreClick get() { return i; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdMassiveCoreClick()
{
// Aliases
this.addAliases("click");
// Parameters
this.addParameter(TypeStringCommand.get(), "command", true).setDesc("the command to perform");
// Requirements
this.addRequirements(RequirementHasPerm.get(MassiveCorePerm.CLICK.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform() throws MassiveException
{
String command = this.readArg();
if ( ! senderIsConsole)
{
MassiveCoreMConf.get().commandClickSound.run(me);
}
Mixin.dispatchCommand(sender, command);
}
}