Added portal rotating

This commit is contained in:
sekwah 2018-02-22 12:36:25 +00:00
parent 67d06b39fd
commit 008009d6c9
6 changed files with 38 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.data.PortalLocation; import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import com.sekwah.advancedportals.coreconnector.container.WorldContainer;
public class CoreListeners { public class CoreListeners {
@ -95,6 +96,16 @@ public class CoreListeners {
AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick); AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick);
return false; 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; return true;
} }

View File

@ -23,7 +23,7 @@ public class EndGatewayBlockSubCommand implements SubCommand {
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly")); sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly"));
} }
else { else {
player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A78Gateway Block Placer" player.giveWool("BLACK", "\u00A78Gateway Block Placer"
, "\u00A7rThis wool is made of a magical substance", , "\u00A7rThis wool is made of a magical substance",
"\u00A7rRight Click: Place portal block"); "\u00A7rRight Click: Place portal block");
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.gatewayblock")); sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.gatewayblock"));

View File

@ -23,7 +23,7 @@ public class EndPortalBlockSubCommand implements SubCommand {
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly")); sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly"));
} }
else { 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", , "\u00A7rThis wool is made of a magical substance",
"\u00A7rRight Click: Place portal block"); "\u00A7rRight Click: Place portal block");
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.endportalblock")); sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("command.endportalblock"));

View File

@ -23,7 +23,7 @@ public class PortalBlockSubCommand implements SubCommand {
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly")); sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translate("command.playeronly"));
} }
else { else {
player.giveItem(this.portalsCore.getConfig().getSelectorMaterial(), "\u00A75Portal Block Placer" player.giveWool("PURPLE", "\u00A75Portal Block Placer"
, "\u00A7rThis wool is made of a magical substance", , "\u00A7rThis wool is made of a magical substance",
"\u00A7rRight Click: Place portal block", "\u00A7rRight Click: Place portal block",
"\u00A7rLeft Click: Rotate portal block"); "\u00A7rLeft Click: Rotate portal block");

View File

@ -34,6 +34,8 @@ public class PlayerContainer {
return false; return false;
} }
public WorldContainer getWorld() {return null;}
/** /**
* @param blockPos * @param blockPos
* @param material * @param material
@ -53,4 +55,6 @@ public class PlayerContainer {
} }
public void giveItem(String material, String itemName, String... itemDescription) {} public void giveItem(String material, String itemName, String... itemDescription) {}
public void giveWool(String dyeColor, String itemName, String... itemDescription) {}
} }

View File

@ -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;
}
}