Discussion forum > Suggestions
Lava Buckets in Furnaces
cschurz:
--- Quote from: tiggy26668 on April 13, 2013, 04:35:52 am ---
--- Quote from: Chief149 on April 13, 2013, 02:40:31 am ---Basically to implement this:
1) Register a BlockPlaceEvent handler to the Opticraft server plugin (if not already done).
2) On the onBlockPlace method call add this:
public void onBlockPlace(BlockPlaceEvent bpEvent)
{
if(bpEvent.getBlockPlaced().getType() == Material.STATIONARY_LAVA)
{
if(!bpEvent.getPlayer().hasPermission("some.override.permission.for.moderators")))
{
bpEvent.setCancelled(true);
}
}
}
Personally I would have preffered to combine the two IF statements into one using &&, but since the forum text editor was being wierd I found it to look nicer for viewing with two seperate statements.
Basically, on each and every block placement, the above method is called. Then we check if the block placed is STATIONARY_LAVA, or a lava source block which is what is placed by a filled lava bucket. If I'm wrong then simply change the Material.<material> part on the first IF statement.
If it is a lava block, then check to see if the player who placed the lava has the override permission (such as a moderator permission). Notice I have the ! in front of the hasPermission() call. For those who don't know how to program, that simply stands for if the player DOESNT have the permission. If not, then we set the event state to be cancelled, and Bukkit does the rest.
Add that to the opticraft plugin, and allow lava buckets to be used. That code will block lava placement, but not picking up lava. So long as we can fill a lava bucket, we can use it in a furnace. No harm can be done as long as players can't place the lava.
--- End quote ---
lol you made the same mistake as cschurz :P
what about lava that isn't stationary? ;D
--- End quote ---
optical made that mistake, not me :)
--- Quote from: Chief149 on April 13, 2013, 02:40:31 am ---Basically to implement this:
1) Register a BlockPlaceEvent handler to the Opticraft server plugin (if not already done).
2) On the onBlockPlace method call add this:
public void onBlockPlace(BlockPlaceEvent bpEvent)
{
if(bpEvent.getBlockPlaced().getType() == Material.STATIONARY_LAVA)
{
if(!bpEvent.getPlayer().hasPermission("some.override.permission.for.moderators")))
{
bpEvent.setCancelled(true);
}
}
}
--- End quote ---
this prevents users from placing stationary lava, yes. we already have that. the problem is that we have code that prevents members from collecting water/lava into buckets. i just removed that, but it's up to optical to approve it and update the server. i don't see why members shouldn't be allowed to collect stuff into buckets.
Nick3306:
--- Quote from: cschurz on April 14, 2013, 12:06:06 am ---
--- Quote from: tiggy26668 on April 13, 2013, 04:35:52 am ---
--- Quote from: Chief149 on April 13, 2013, 02:40:31 am ---Basically to implement this:
1) Register a BlockPlaceEvent handler to the Opticraft server plugin (if not already done).
2) On the onBlockPlace method call add this:
public void onBlockPlace(BlockPlaceEvent bpEvent)
{
if(bpEvent.getBlockPlaced().getType() == Material.STATIONARY_LAVA)
{
if(!bpEvent.getPlayer().hasPermission("some.override.permission.for.moderators")))
{
bpEvent.setCancelled(true);
}
}
}
Personally I would have preffered to combine the two IF statements into one using &&, but since the forum text editor was being wierd I found it to look nicer for viewing with two seperate statements.
Basically, on each and every block placement, the above method is called. Then we check if the block placed is STATIONARY_LAVA, or a lava source block which is what is placed by a filled lava bucket. If I'm wrong then simply change the Material.<material> part on the first IF statement.
If it is a lava block, then check to see if the player who placed the lava has the override permission (such as a moderator permission). Notice I have the ! in front of the hasPermission() call. For those who don't know how to program, that simply stands for if the player DOESNT have the permission. If not, then we set the event state to be cancelled, and Bukkit does the rest.
Add that to the opticraft plugin, and allow lava buckets to be used. That code will block lava placement, but not picking up lava. So long as we can fill a lava bucket, we can use it in a furnace. No harm can be done as long as players can't place the lava.
--- End quote ---
lol you made the same mistake as cschurz :P
what about lava that isn't stationary? ;D
--- End quote ---
optical made that mistake, not me :)
--- Quote from: Chief149 on April 13, 2013, 02:40:31 am ---Basically to implement this:
1) Register a BlockPlaceEvent handler to the Opticraft server plugin (if not already done).
2) On the onBlockPlace method call add this:
public void onBlockPlace(BlockPlaceEvent bpEvent)
{
if(bpEvent.getBlockPlaced().getType() == Material.STATIONARY_LAVA)
{
if(!bpEvent.getPlayer().hasPermission("some.override.permission.for.moderators")))
{
bpEvent.setCancelled(true);
}
}
}
--- End quote ---
this prevents users from placing stationary lava, yes. we already have that. the problem is that we have code that prevents members from collecting water/lava into buckets. i just removed that, but it's up to optical to approve it and update the server. i don't see why members shouldn't be allowed to collect stuff into buckets.
--- End quote ---
Optical made it that way because they cant place it. We were getting tons of complaints about people wasting iron on buckets to have them filled with lava and then they can't do anything with it. Of course this suggestion gives it a use. There were also a lot of bugs with stopping members from placing water/lava. We had numerous cases where placing lava or water was possible even with the restriction.
Chief149:
The only way the restriction could be bypassed would be if another plugin is setting the cancelled state to false. Otherwise its impossible for that bug to be happening.
Nick3306:
--- Quote from: Chief149 on April 14, 2013, 01:27:25 am ---The only way the restriction could be bypassed would be if another plugin is setting the cancelled state to false. Otherwise its impossible for that bug to be happening.
--- End quote ---
Hey, I'm just telling you what was happening. I don't have an explanation for it.
Chief149:
--- Quote from: Nick3306 on April 14, 2013, 01:28:38 am ---
--- Quote from: Chief149 on April 14, 2013, 01:27:25 am ---The only way the restriction could be bypassed would be if another plugin is setting the cancelled state to false. Otherwise its impossible for that bug to be happening.
--- End quote ---
Hey, I'm just telling you what was happening. I don't have an explanation for it.
--- End quote ---
Yeah I understand. I just mentioned the most likely explanation for it. I think it might be worldguard
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version