Merge pull request #126 from sekwah41/portals-old

Fix for wand command
This commit is contained in:
Aztec 2018-08-25 13:50:23 -06:00 committed by GitHub
commit 321d4c8764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 17 deletions

View File

@ -4,7 +4,7 @@ apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.sekwah.advancedportals'
version = '0.0.43-snapshot'
version = '0.0.44-snapshot'
description = ""

View File

@ -55,7 +55,6 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
if (sender.hasPermission("advancedportals.portal")) {
if (args.length > 0) { switch (args[0].toLowerCase()) {
case "wand":
case "warp":
if (args.length == 2 && player.hasPermission("advancedportals.portal.warp")){
for (AdvancedPortal portal: Portal.portals){
@ -72,6 +71,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
}
sendMenu(player, "Help Menu: Warp", "\u00A76/" + command + " warp <name> \u00A7a- teleport to warp name");
break;
case "wand":
case "selector":
String ItemID = config.getConfig().getString("AxeItemId");
@ -171,15 +171,14 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
} else if (args[i].toLowerCase().startsWith("triggerblock:") && args[i].length() > 13) {
hasTriggerBlock = true;
triggerBlock = args[i].toLowerCase().replaceFirst("triggerblock:", "");
} else if (args[i].toLowerCase().startsWith("bungee:") && args[i].length() > 7) { // not completely implemented
} else if (this.startsWithPortalArg("bungee:", args[i])) {
isBungeePortal = true;
serverName = args[i].toLowerCase().replaceFirst("bungee:", "");
//extraData.add(new PortalArgs("bungee", serverName));
} else if (args[i].toLowerCase().startsWith("permission:") && args[i].length() > 11) { // not completely implemented
serverName = args[i].substring("bungee:".length());
} else if (args[i].toLowerCase().startsWith("permission:") && args[i].length() > 11) {
needsPermission = true;
permission = args[i].toLowerCase().replaceFirst("permission:", "");
extraData.add(new PortalArg("permission", permission));
} else if (args[i].toLowerCase().startsWith("command:") && args[i].length() > 8) { // not completely implemented
} else if (args[i].toLowerCase().startsWith("command:") && args[i].length() > 8) {
executesCommand = true;
portalCommand = parseArgVariable(args, i, "command:");
i += this.portalArgsStringLength - 1;
@ -506,6 +505,10 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
return true;
}
private boolean startsWithPortalArg(String portalArg, String arg) {
return arg.toLowerCase().startsWith(portalArg) && arg.length() > portalArg.length();
}
private void helpCommand(CommandSender sender, String command, String[] args) {
// Add pages if there starts to become too many
if(args.length == 1) {

View File

@ -6,12 +6,11 @@ import com.sekwah.advancedportals.PluginMessages;
import com.sekwah.advancedportals.api.events.WarpEvent;
import com.sekwah.advancedportals.portals.AdvancedPortal;
import com.sekwah.advancedportals.portals.Portal;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.*;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Orientable;
import org.bukkit.block.data.Rotatable;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -259,12 +258,12 @@ public class Listeners implements Listener {
} else if (checkItemForName(event.getItem()) && event.getItem().getItemMeta().getDisplayName().equals("\u00A75Portal Block Placer") &&
event.getAction() == Action.LEFT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.NETHER_PORTAL) {
BlockData block = event.getClickedBlock().getBlockData();
if(block instanceof Rotatable) {
Rotatable rotatable = (Rotatable) block;
if (rotatable.getRotation() == BlockFace.NORTH) {
rotatable.setRotation(BlockFace.EAST);
if(block instanceof Orientable) {
Orientable rotatable = (Orientable) block;
if (rotatable.getAxis() == Axis.X) {
rotatable.setAxis(Axis.Z);
} else {
rotatable.setRotation(BlockFace.NORTH);
rotatable.setAxis(Axis.X);
}
}
event.setCancelled(true);

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
name: AdvancedPortals
version: 0.0.43
version: 0.0.44
author: sekwah41
description: An advanced portals plugin for bukkit.
api-version: 1.13