Jump to content

[1.7.2] Button's action in custom GUI keep crashing the server


DonKresenko

Recommended Posts

I created a block with it's own GUI. What the GUI dose is that creates an explosion based on number you input in the text box. Everything works on singleplayer, but on multiplayer, the server crashes when i click on the button

 

Here's the method

 

protected void actionPerformed(GuiButton button) {

 

World world = null;

WorldServer[] list = MinecraftServer.getServer().worldServers; // in console it says this line crashes

 

for (WorldServer ins : list) {

if (ins.provider.dimensionId == entity.worldObj.provider.dimensionId)

world = ins;

}

if (world == null)

world = list[0];

 

if (button.id == 0) {

 

if (true) {

if (power.getText().isEmpty())

power.setText("");

else if (power.getText().matches("[a-zA-Z]+"))

power.setText("");

else if (power.getText().matches("[0-9]+")) {

this.mc.displayGuiScreen((GuiScreen) null);

world.createExplosion((Entity) null, i, j - 10, k, Integer.parseInt(power.getText().trim()), true);

}

else

power.setText("");

}

 

}

 

}

 

 

_         

___ ___| |__  _ __ 

/ __/ __| '_ \| '_ \

\__ \__ \ | | | | | |

|___/___/_| |_|_| |_|

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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