Added portal blocks

This commit is contained in:
sekwah 2018-02-22 12:25:30 +00:00 committed by Sekwah
parent be3fabb004
commit a53563f02e
5 changed files with 170 additions and 1 deletions

View File

@ -55,12 +55,18 @@ command.remove.error= Removing the portal was blocked:
command.remove.noname=No portal by that name was found
command.remove.invalidselection=The portal selection you had is no longer valid
command.remove.noselection=You don't have a portal selected
command.create.complete= The portal has been successfully removed.
command.remove.complete= The portal has been successfully removed.
command.selector= You have been given a portal selector.
command.selector.help=Gives you a portal region selector
command.selector.detailedhelp=Gives you a portal selector to select the regions for making portals.
command.portalblock= You have been given a \u00A7ePortal Block\u00A7a!
command.endportalblock= You have been given a \u00A78End Portal Block Placer\u00A7a!
command.gatewayblock= You have been given a \u00A78Gateway Block Placer\u00A7a!
portal.error.invalidselection=You must have both pos1 and pos2 selected to create a portal.
portal.error.takenname=The name given for the portal is already taken.
portal.error.selection.differentworlds=Both the selected points need to be in the same world.

View File

@ -131,6 +131,9 @@ public class AdvancedPortalsCore {
this.portalCommand.registerSubCommand("transupdate", new TransUpdateSubCommand(this));
this.portalCommand.registerSubCommand("reload", new ReloadSubCommand(this));
this.portalCommand.registerSubCommand("selector", new SelectorSubCommand(this), "wand");
this.portalCommand.registerSubCommand("portalblock", new PortalBlockSubCommand(this));
this.portalCommand.registerSubCommand("endportalblock", new EndPortalBlockSubCommand(this));
this.portalCommand.registerSubCommand("endgatewayblock", new EndGatewayBlockSubCommand(this));
this.portalCommand.registerSubCommand("create", new CreatePortalSubCommand());
this.portalCommand.registerSubCommand("remove", new RemoveSubCommand());

View File

@ -0,0 +1,53 @@
package com.sekwah.advancedportals.core.commands.subcommands.portal;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.commands.SubCommand;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import java.util.List;
public class EndGatewayBlockSubCommand implements SubCommand {
private final AdvancedPortalsCore portalsCore;
public EndGatewayBlockSubCommand(AdvancedPortalsCore portalsCore) {
this.portalsCore = portalsCore;
}
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
PlayerContainer player = sender.getPlayerContainer();
if(player == null) {
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly"));
}
else {
player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A78Gateway Block Placer"
, "\u00A7rThis wool is made of a magical substance",
"\u00A7rRight Click: Place portal block");
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.gatewayblock"));
}
}
@Override
public boolean hasPermission(CommandSenderContainer sender) {
return sender.isOp() || sender.hasPermission("advancedportals.createportal");
}
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
return null;
}
@Override
public String getBasicHelpText() {
return Lang.translate("command.selector.help");
}
@Override
public String getDetailedHelpText() {
return Lang.translate("command.selector.detailedhelp");
}
}

View File

@ -0,0 +1,53 @@
package com.sekwah.advancedportals.core.commands.subcommands.portal;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.commands.SubCommand;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import java.util.List;
public class EndPortalBlockSubCommand implements SubCommand {
private final AdvancedPortalsCore portalsCore;
public EndPortalBlockSubCommand(AdvancedPortalsCore portalsCore) {
this.portalsCore = portalsCore;
}
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
PlayerContainer player = sender.getPlayerContainer();
if(player == null) {
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly"));
}
else {
player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A78End Portal Block Placer"
, "\u00A7rThis wool is made of a magical substance",
"\u00A7rRight Click: Place portal block");
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.endportalblock"));
}
}
@Override
public boolean hasPermission(CommandSenderContainer sender) {
return sender.isOp() || sender.hasPermission("advancedportals.createportal");
}
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
return null;
}
@Override
public String getBasicHelpText() {
return Lang.translate("command.selector.help");
}
@Override
public String getDetailedHelpText() {
return Lang.translate("command.selector.detailedhelp");
}
}

View File

@ -0,0 +1,54 @@
package com.sekwah.advancedportals.core.commands.subcommands.portal;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.commands.SubCommand;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import java.util.List;
public class PortalBlockSubCommand implements SubCommand {
private final AdvancedPortalsCore portalsCore;
public PortalBlockSubCommand(AdvancedPortalsCore portalsCore) {
this.portalsCore = portalsCore;
}
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
PlayerContainer player = sender.getPlayerContainer();
if(player == null) {
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly"));
}
else {
player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A75Portal Block Placer"
, "\u00A7rThis wool is made of a magical substance",
"\u00A7rRight Click: Place portal block",
"\u00A7rLeft Click: Rotate portal block");
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.portalblock"));
}
}
@Override
public boolean hasPermission(CommandSenderContainer sender) {
return sender.isOp() || sender.hasPermission("advancedportals.createportal");
}
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
return null;
}
@Override
public String getBasicHelpText() {
return Lang.translate("command.selector.help");
}
@Override
public String getDetailedHelpText() {
return Lang.translate("command.selector.detailedhelp");
}
}