Added what i think is the code for portal placing
This commit is contained in:
parent
008009d6c9
commit
74b26b4a4e
6
TODO.md
6
TODO.md
|
@ -4,15 +4,11 @@ Main Tasks (Generally should be done in order)
|
|||
|
||||
Tag registration system (Mostly done, just needs to be tested and implemented)
|
||||
|
||||
Portal loading system
|
||||
|
||||
Portal trigger system
|
||||
|
||||
Configs for language files to allow all messages to change
|
||||
|
||||
Destination Command
|
||||
|
||||
Portal Command
|
||||
Change item data from strings to an object with strings in maybe
|
||||
|
||||
Bungee Support Set Locations
|
||||
|
||||
|
|
|
@ -72,6 +72,31 @@ public class CoreListeners {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @player player causing the event (or null if not a player)
|
||||
* @param blockPos
|
||||
* @param blockMaterial
|
||||
* @return if the block is allowed to be placed
|
||||
*/
|
||||
public boolean blockPlace(PlayerContainer player, PortalLocation blockPos, String blockMaterial, String itemInHandMaterial, String itemInHandName) {
|
||||
if(player != null && player.hasPermission("advancedportals.build")) {
|
||||
WorldContainer world = player.getWorld();
|
||||
if(itemInHandName.equals("\u00A75Portal Block Placer")) {
|
||||
world.setBlock(blockPos, "PORTAL");
|
||||
return false;
|
||||
}
|
||||
else if(itemInHandName.equals("\u00A78End Portal Block Placer")) {
|
||||
world.setBlock(blockPos, "ENDER_PORTAL");
|
||||
return false;
|
||||
}
|
||||
else if(itemInHandName.equals("\u00A78Gateway Block Placer")) {
|
||||
world.setBlock(blockPos, "END_GATEWAY");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the block is allowed to be interacted with e.g. a lever
|
||||
* @player player causing the event (or null if not a player)
|
||||
|
@ -96,7 +121,7 @@ public class CoreListeners {
|
|||
AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick);
|
||||
return false;
|
||||
}
|
||||
else if(leftClick || itemName.equals("\u00A75Portal Block Placer")) {
|
||||
else if(leftClick && itemName.equals("\u00A75Portal Block Placer") && player.hasPermission("advancedportals.build")) {
|
||||
WorldContainer world = player.getWorld();
|
||||
if(world.getBlockData(blockLoc) == 1) {
|
||||
world.setBlockData(blockLoc, (byte) 2);
|
||||
|
|
Loading…
Reference in New Issue