From 008009d6c98600abc0019e10ac8a6114c5544ee2 Mon Sep 17 00:00:00 2001 From: sekwah Date: Thu, 22 Feb 2018 12:36:25 +0000 Subject: [PATCH] Added portal rotating --- .../advancedportals/core/CoreListeners.java | 11 ++++++++++ .../portal/EndGatewayBlockSubCommand.java | 2 +- .../portal/EndPortalBlockSubCommand.java | 2 +- .../portal/PortalBlockSubCommand.java | 2 +- .../container/PlayerContainer.java | 4 ++++ .../container/WorldContainer.java | 20 +++++++++++++++++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 src/com/sekwah/advancedportals/coreconnector/container/WorldContainer.java diff --git a/src/com/sekwah/advancedportals/core/CoreListeners.java b/src/com/sekwah/advancedportals/core/CoreListeners.java index e6f2839..0dc5d27 100644 --- a/src/com/sekwah/advancedportals/core/CoreListeners.java +++ b/src/com/sekwah/advancedportals/core/CoreListeners.java @@ -4,6 +4,7 @@ import com.sekwah.advancedportals.core.data.PlayerLocation; import com.sekwah.advancedportals.core.data.PortalLocation; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; +import com.sekwah.advancedportals.coreconnector.container.WorldContainer; public class CoreListeners { @@ -95,6 +96,16 @@ public class CoreListeners { AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick); return false; } + else if(leftClick || itemName.equals("\u00A75Portal Block Placer")) { + WorldContainer world = player.getWorld(); + if(world.getBlockData(blockLoc) == 1) { + world.setBlockData(blockLoc, (byte) 2); + } + else { + world.setBlockData(blockLoc, (byte) 1); + } + } + return true; } diff --git a/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java b/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java index d38353e..48ad9b1 100644 --- a/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java +++ b/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java @@ -23,7 +23,7 @@ public class EndGatewayBlockSubCommand implements SubCommand { sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly")); } else { - player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A78Gateway Block Placer" + player.giveWool("BLACK", "\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")); diff --git a/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java b/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java index 341353c..5fb64e3 100644 --- a/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java +++ b/src/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java @@ -23,7 +23,7 @@ public class EndPortalBlockSubCommand implements SubCommand { sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly")); } else { - player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A78End Portal Block Placer" + player.giveWool("BLACK", "\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")); diff --git a/src/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java b/src/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java index 3ee18b2..f0906e7 100644 --- a/src/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java +++ b/src/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java @@ -23,7 +23,7 @@ public class PortalBlockSubCommand implements SubCommand { sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly")); } else { - player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A75Portal Block Placer" + player.giveWool("PURPLE", "\u00A75Portal Block Placer" , "\u00A7rThis wool is made of a magical substance", "\u00A7rRight Click: Place portal block", "\u00A7rLeft Click: Rotate portal block"); diff --git a/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java b/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java index d96cf9e..3787563 100644 --- a/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java +++ b/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java @@ -34,6 +34,8 @@ public class PlayerContainer { return false; } + public WorldContainer getWorld() {return null;} + /** * @param blockPos * @param material @@ -53,4 +55,6 @@ public class PlayerContainer { } public void giveItem(String material, String itemName, String... itemDescription) {} + + public void giveWool(String dyeColor, String itemName, String... itemDescription) {} } diff --git a/src/com/sekwah/advancedportals/coreconnector/container/WorldContainer.java b/src/com/sekwah/advancedportals/coreconnector/container/WorldContainer.java new file mode 100644 index 0000000..ccc8748 --- /dev/null +++ b/src/com/sekwah/advancedportals/coreconnector/container/WorldContainer.java @@ -0,0 +1,20 @@ +package com.sekwah.advancedportals.coreconnector.container; + +import com.sekwah.advancedportals.core.data.PortalLocation; + +public class WorldContainer { + + public void setBlock(PortalLocation location, String material) { + } + + public void setBlockData(PortalLocation location, byte data) { + } + + public String getBlock(PortalLocation location) { + return ""; + } + + public byte getBlockData(PortalLocation location) { + return 0; + } +}