mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-12-23 09:28:06 +01:00
Added what i think is the code for portal placing
This commit is contained in:
parent
09c7ed656e
commit
85fd6a2b9b
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
Block a user