Jump to content

Recommended Posts

Posted

I was using an event and i needed to check some strings to see if they didn't match but for some reason they always never match.

 

Code:

@ForgeSubscribe
public void blockBroken(BreakEvent event)
{

	if(event.block instanceof BlockDesk)
	{
		System.out.println(event.getPlayer().username);
		TileEntityDesk desk = (TileEntityDesk) event.world.getBlockTileEntity(event.x, event.y, event.z);
		System.out.println(desk.owner);
		if(desk.owner != null)
		{
			if(event.getPlayer().username.equals(desk.owner) == false);
			{
			event.setCanceled(true);
			}
		}
	}
}

 

and the 2 prints both say jdb100 which is my username.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.