Always use the username of the command target if the command exceeds the maximum chat message length and command blocks need to be used

This commit is contained in:
Marcel Konrad
2020-07-29 01:34:29 +02:00
parent f99f6073b8
commit 19b42448bf
26 changed files with 140 additions and 133 deletions

View File

@@ -124,11 +124,11 @@ public class ContentAdvancements extends Content
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.grant"), () -> container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.grant"), () ->
{ {
CommandHelper.sendCommand(this.builderAdvancement.getBuilderForAction(EnumActionType.GRANT)); CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement.getBuilderForAction(EnumActionType.GRANT));
})); }));
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.revoke"), () -> container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.revoke"), () ->
{ {
CommandHelper.sendCommand(this.builderAdvancement.getBuilderForAction(EnumActionType.REVOKE)); CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement.getBuilderForAction(EnumActionType.REVOKE));
})); }));
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").func_240699_a_(TextFormatting.RED), () -> container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").func_240699_a_(TextFormatting.RED), () ->
{ {

View File

@@ -104,7 +104,7 @@ public class ContentButcher extends Content
container.add(slaughter = new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.slaughter"), () -> container.add(slaughter = new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.slaughter"), () ->
{ {
ContentButcher.slaughter(Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITIES::getValue).filter(Predicates.notNull()).collect(Collectors.toList()), Integer.parseInt(this.radius)); ContentButcher.slaughter(container.getPlayer(), Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITIES::getValue).filter(Predicates.notNull()).collect(Collectors.toList()), Integer.parseInt(this.radius));
})); }));
slaughter.field_230693_o_ = enabled && !Config.getButcher().getEntities().isEmpty(); slaughter.field_230693_o_ = enabled && !Config.getButcher().getEntities().isEmpty();
@@ -115,7 +115,7 @@ public class ContentButcher extends Content
slaughter.field_230693_o_ = enabled; slaughter.field_230693_o_ = enabled;
} }
public static void slaughter(Collection<EntityType<?>> entities, int radius) public static void slaughter(String player, Collection<EntityType<?>> entities, int radius)
{ {
AxisAlignedBB aabb = new AxisAlignedBB(Minecraft.getInstance().player.func_233580_cy_()).grow(radius); AxisAlignedBB aabb = new AxisAlignedBB(Minecraft.getInstance().player.func_233580_cy_()).grow(radius);
@@ -126,7 +126,7 @@ public class ContentButcher extends Content
if(!targets.isEmpty()) if(!targets.isEmpty())
{ {
CommandHelper.sendCommand(new BuilderButcher(entity.getRegistryName(), radius)); CommandHelper.sendCommand(player, new BuilderButcher(entity.getRegistryName(), radius));
} }
} }
} }

View File

@@ -50,22 +50,22 @@ public class ContentButcherPresets extends ContentChild
container.add(new GuiButtonBase(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.passive_mobs"), () -> container.add(new GuiButtonBase(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.passive_mobs"), () ->
{ {
ContentButcher.slaughter(Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITIES::getValue).filter(Predicates.notNull()).collect(Collectors.toList()), this.radius); ContentButcher.slaughter(container.getPlayer(), Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITIES::getValue).filter(Predicates.notNull()).collect(Collectors.toList()), this.radius);
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent())); Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
})); }));
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.hostile_mobs"), () -> container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
{ {
ContentButcher.slaughter(ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> !EntityClassification.MISC.equals(entity.getClassification()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> !EntityClassification.MISC.equals(entity.getClassification()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent())); Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
})); }));
container.add(new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.entities"), () -> container.add(new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.entities"), () ->
{ {
ContentButcher.slaughter(ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MISC.equals(entity.getClassification()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MISC.equals(entity.getClassification()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent())); Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
})); }));
container.add(new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.players"), () -> container.add(new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.players"), () ->
{ {
ContentButcher.slaughter(ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius); ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent())); Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
})); }));
} }

View File

@@ -34,17 +34,17 @@ public class ContentContainers extends Content
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.func_235333_g_(), () -> container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.func_235333_g_(), () ->
{ {
BlockHelper.setBlockNearPlayer(Blocks.CRAFTING_TABLE); BlockHelper.setBlockNearPlayer(container.getPlayer(), Blocks.CRAFTING_TABLE);
ActionHelper.backToGame(); ActionHelper.backToGame();
})); }));
container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.func_235333_g_(), () -> container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.func_235333_g_(), () ->
{ {
BlockHelper.setBlockNearPlayer(Blocks.ENDER_CHEST); BlockHelper.setBlockNearPlayer(container.getPlayer(), Blocks.ENDER_CHEST);
ActionHelper.backToGame(); ActionHelper.backToGame();
})); }));
container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.func_235333_g_(), () -> container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.func_235333_g_(), () ->
{ {
BlockHelper.setBlockNearPlayer(Blocks.ANVIL); BlockHelper.setBlockNearPlayer(container.getPlayer(), Blocks.ANVIL);
ActionHelper.backToGame(); ActionHelper.backToGame();
})); }));
container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.func_235333_g_(), () -> container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.func_235333_g_(), () ->
@@ -74,7 +74,7 @@ public class ContentContainers extends Content
if(block != null) if(block != null)
{ {
CommandHelper.sendCommand(new BuilderSetBlock(new CoordinateInt(cx, EnumType.GLOBAL), new CoordinateInt(yOffset, EnumType.GLOBAL), new CoordinateInt(cz, EnumType.GLOBAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode())); CommandHelper.sendCommand(container.getPlayer(), new BuilderSetBlock(new CoordinateInt(cx, EnumType.GLOBAL), new CoordinateInt(yOffset, EnumType.GLOBAL), new CoordinateInt(cz, EnumType.GLOBAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode()));
} }
} }
} }
@@ -85,19 +85,19 @@ public class ContentContainers extends Content
container.add(new GuiButtonItem(x, y, 20, 20, new ItemStack(Blocks.CRAFTING_TABLE), () -> container.add(new GuiButtonItem(x, y, 20, 20, new ItemStack(Blocks.CRAFTING_TABLE), () ->
{ {
CommandHelper.sendCommand(new BuilderGive(container.getPlayer(), Blocks.CRAFTING_TABLE.getRegistryName())); CommandHelper.sendCommand(container.getPlayer(), new BuilderGive(container.getPlayer(), Blocks.CRAFTING_TABLE.getRegistryName()));
})); }));
container.add(new GuiButtonItem(x, y + 24, 20, 20, new ItemStack(Blocks.ENDER_CHEST), () -> container.add(new GuiButtonItem(x, y + 24, 20, 20, new ItemStack(Blocks.ENDER_CHEST), () ->
{ {
CommandHelper.sendCommand(new BuilderGive(container.getPlayer(), Blocks.ENDER_CHEST.getRegistryName())); CommandHelper.sendCommand(container.getPlayer(), new BuilderGive(container.getPlayer(), Blocks.ENDER_CHEST.getRegistryName()));
})); }));
container.add(new GuiButtonItem(x, y + 48, 20, 20, new ItemStack(Blocks.ANVIL), () -> container.add(new GuiButtonItem(x, y + 48, 20, 20, new ItemStack(Blocks.ANVIL), () ->
{ {
CommandHelper.sendCommand(new BuilderGive(container.getPlayer(), Blocks.ANVIL.getRegistryName())); CommandHelper.sendCommand(container.getPlayer(), new BuilderGive(container.getPlayer(), Blocks.ANVIL.getRegistryName()));
})); }));
container.add(new GuiButtonItem(x, y + 72, 20, 20, new ItemStack(Blocks.ENCHANTING_TABLE), () -> container.add(new GuiButtonItem(x, y + 72, 20, 20, new ItemStack(Blocks.ENCHANTING_TABLE), () ->
{ {
CommandHelper.sendCommand(new BuilderGive(container.getPlayer(), Blocks.ENCHANTING_TABLE.getRegistryName())); CommandHelper.sendCommand(container.getPlayer(), new BuilderGive(container.getPlayer(), Blocks.ENCHANTING_TABLE.getRegistryName()));
})); }));
} }

View File

@@ -69,7 +69,7 @@ public class ContentContinue extends ContentChild
container.add(this.commandField); container.add(this.commandField);
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").func_240699_a_(TextFormatting.RED), () -> container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").func_240699_a_(TextFormatting.RED), () ->
{ {
CommandHelper.sendCommand(this.builder, this.special); CommandHelper.sendCommand(container.getPlayer(), this.builder, this.special);
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent())); Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
})); }));
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.no"), () -> ActionHelper.back(this))); container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));

View File

@@ -278,19 +278,19 @@ public class ContentCustomItem extends Content
if(!this.builderCutomItem.needsCommandBlock() && !this.builderCutomItem.getName().isSpecial()) if(!this.builderCutomItem.needsCommandBlock() && !this.builderCutomItem.getName().isSpecial())
{ {
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.custom_item"), this::send)); container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.custom_item"), () -> this.send(container.getPlayer())));
} }
else else
{ {
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), this::send)); container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> this.send(container.getPlayer())));
} }
button4.field_230693_o_ = ResourceHelper.isRegistered(ResourceHelper.stringToResourceLocation(this.item), ForgeRegistries.ITEMS); button4.field_230693_o_ = ResourceHelper.isRegistered(ResourceHelper.stringToResourceLocation(this.item), ForgeRegistries.ITEMS);
} }
private void send() private void send(String player)
{ {
CommandHelper.sendCommand(this.builderCutomItem, this.builderCutomItem.getName().isSpecial()); CommandHelper.sendCommand(player, this.builderCutomItem, this.builderCutomItem.getName().isSpecial());
} }
@Override @Override

View File

@@ -228,7 +228,7 @@ public class ContentEditBlocks extends Content
container.add(this.block1Field); container.add(this.block1Field);
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.fill"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.fill"), () ->
{ {
CommandHelper.sendCommand(this.builderFill.getBuilderForFill()); CommandHelper.sendCommand(container.getPlayer(), this.builderFill.getBuilderForFill());
})); }));
button1.field_230693_o_ = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS); button1.field_230693_o_ = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS);
} }
@@ -246,7 +246,7 @@ public class ContentEditBlocks extends Content
container.add(this.block2Field); container.add(this.block2Field);
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace"), () ->
{ {
CommandHelper.sendCommand(this.builderFill.getBuilderForReplace()); CommandHelper.sendCommand(container.getPlayer(), this.builderFill.getBuilderForReplace());
})); }));
button1.field_230693_o_ = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS) && ResourceHelper.isRegistered(this.builderFill.getBlock2(), ForgeRegistries.BLOCKS); button1.field_230693_o_ = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS) && ResourceHelper.isRegistered(this.builderFill.getBlock2(), ForgeRegistries.BLOCKS);
} }
@@ -302,7 +302,7 @@ public class ContentEditBlocks extends Content
container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone"), () -> container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone"), () ->
{ {
CommandHelper.sendCommand(this.builderClone); CommandHelper.sendCommand(container.getPlayer(), this.builderClone);
})); }));
try try

View File

@@ -91,7 +91,7 @@ public class ContentEnchantment extends Content
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.enchantment.enchant"), () -> container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.enchantment.enchant"), () ->
{ {
CommandHelper.sendCommand(this.builderEnchantment); CommandHelper.sendCommand(container.getPlayer(), this.builderEnchantment);
})); }));
} }

View File

@@ -55,16 +55,16 @@ public class ContentExperience extends Content
container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () -> container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
{ {
CommandHelper.sendCommand(this.builderExperience.getBuilderForAddLevels()); CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.getBuilderForAddLevels());
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () -> container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
{ {
CommandHelper.sendCommand(this.builderExperience.getBuilderForRemoveLevels()); CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.getBuilderForRemoveLevels());
})); }));
container.add(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset"), new TranslationTextComponent("gui.worldhandler.actions.set_to_0"), () -> container.add(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset"), new TranslationTextComponent("gui.worldhandler.actions.set_to_0"), () ->
{ {
CommandHelper.sendCommand(this.builderExperience.getBuilderForResetLevels()); CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.getBuilderForResetLevels());
container.func_231160_c_(); container.func_231160_c_();
})); }));

View File

@@ -133,11 +133,11 @@ public class ContentGamerules extends Content
{ {
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () -> container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
{ {
CommandHelper.sendCommand(this.builderGamerule.getBuilderForValue(String.valueOf(true))); CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule.getBuilderForValue(String.valueOf(true)));
})); }));
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () -> container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
{ {
CommandHelper.sendCommand(this.builderGamerule.getBuilderForValue(String.valueOf(false))); CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule.getBuilderForValue(String.valueOf(false)));
})); }));
} }
else else
@@ -145,7 +145,7 @@ public class ContentGamerules extends Content
container.add(this.valueField); container.add(this.valueField);
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () -> container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
{ {
CommandHelper.sendCommand(this.builderGamerule); CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule);
})); }));
} }
} }

View File

@@ -152,11 +152,11 @@ public class ContentMultiplayer extends Content
container.add(this.reasonField); container.add(this.reasonField);
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick"), new StringTextComponent(this.builderKick.toActualCommand()), () -> container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick"), new StringTextComponent(this.builderKick.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderKick); CommandHelper.sendCommand(container.getPlayer(), this.builderKick);
})); }));
container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.ban"), new StringTextComponent(this.builderBan.toActualCommand()), () -> container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.ban"), new StringTextComponent(this.builderBan.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderBan); CommandHelper.sendCommand(container.getPlayer(), this.builderBan);
})); }));
if(this.playerField.getText().isEmpty()) if(this.playerField.getText().isEmpty())
@@ -172,7 +172,7 @@ public class ContentMultiplayer extends Content
container.add(this.playerField); container.add(this.playerField);
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.pardon"), new StringTextComponent(this.builderPardon.toActualCommand()), () -> container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.pardon"), new StringTextComponent(this.builderPardon.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderPardon); CommandHelper.sendCommand(container.getPlayer(), this.builderPardon);
})); }));
if(this.playerField.getText().isEmpty()) if(this.playerField.getText().isEmpty())
@@ -187,11 +187,11 @@ public class ContentMultiplayer extends Content
container.add(this.playerField); container.add(this.playerField);
container.add(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.give"), new StringTextComponent(this.builderOp.toActualCommand()), () -> container.add(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.give"), new StringTextComponent(this.builderOp.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderOp); CommandHelper.sendCommand(container.getPlayer(), this.builderOp);
})); }));
container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.take"), new StringTextComponent(this.builderDeop.toActualCommand()), () -> container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.take"), new StringTextComponent(this.builderDeop.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderDeop); CommandHelper.sendCommand(container.getPlayer(), this.builderDeop);
})); }));
if(this.playerField.getText().isEmpty()) if(this.playerField.getText().isEmpty())
@@ -206,11 +206,11 @@ public class ContentMultiplayer extends Content
{ {
container.add(new GuiButtonTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.save_world"), new StringTextComponent(this.builderSaveAll.toActualCommand()), () -> container.add(new GuiButtonTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.save_world"), new StringTextComponent(this.builderSaveAll.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderSaveAll); CommandHelper.sendCommand(container.getPlayer(), this.builderSaveAll);
})); }));
container.add(new GuiButtonTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.on")), new StringTextComponent(this.builderSaveOn.toActualCommand()), () -> container.add(new GuiButtonTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.on")), new StringTextComponent(this.builderSaveOn.toActualCommand()), () ->
{ {
CommandHelper.sendCommand(this.builderSaveOn); CommandHelper.sendCommand(container.getPlayer(), this.builderSaveOn);
})); }));
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).func_240699_a_(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () -> container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).func_240699_a_(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () ->
{ {
@@ -228,25 +228,25 @@ public class ContentMultiplayer extends Content
container.add(this.playerField); container.add(this.playerField);
container.add(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.add"), () -> container.add(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.add"), () ->
{ {
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.ADD)); CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.getBuilder(EnumMode.ADD));
})); }));
container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.remove"), () -> container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.remove"), () ->
{ {
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.REMOVE)); CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.getBuilder(EnumMode.REMOVE));
})); }));
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.on")), () -> container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.on")), () ->
{ {
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.ON)); CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.getBuilder(EnumMode.ON));
})); }));
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.off")), () -> container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.off")), () ->
{ {
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.OFF)); CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.getBuilder(EnumMode.OFF));
})); }));
container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.reload"), () -> container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.reload"), () ->
{ {
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.RELOAD)); CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.getBuilder(EnumMode.RELOAD));
})); }));
if(this.playerField.getText().isEmpty()) if(this.playerField.getText().isEmpty())

View File

@@ -68,109 +68,109 @@ public class ContentNoteEditor extends Content
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () -> container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(1)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(1));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(3)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(3));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(5)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(5));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(6)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(6));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(8)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(8));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(10)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(10));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(11)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(11));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(13)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(13));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(15)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(15));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(17)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(17));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(18)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(18));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(20)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(20));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(22)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(22));
})); }));
container.add(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () -> container.add(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(23)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(23));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, new StringTextComponent("F#"), sound, 0.5F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, new StringTextComponent("F#"), sound, 0.5F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(0)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(0));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, new StringTextComponent("G#"), sound, 0.56F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, new StringTextComponent("G#"), sound, 0.56F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(2)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(2));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, new StringTextComponent("A#"), sound, 0.63F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, new StringTextComponent("A#"), sound, 0.63F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(4)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(4));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, new StringTextComponent("C#"), sound, 0.75F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, new StringTextComponent("C#"), sound, 0.75F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(7)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(7));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, new StringTextComponent("D#"), sound, 0.85F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, new StringTextComponent("D#"), sound, 0.85F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(9)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(9));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, new StringTextComponent("F#"), sound, 1.0F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, new StringTextComponent("F#"), sound, 1.0F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(12)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(12));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, new StringTextComponent("G#"), sound, 1.1F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, new StringTextComponent("G#"), sound, 1.1F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(14)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(14));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, new StringTextComponent("A#"), sound, 1.25F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, new StringTextComponent("A#"), sound, 1.25F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(16)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(16));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, new StringTextComponent("C#"), sound, 1.5F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, new StringTextComponent("C#"), sound, 1.5F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(19)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(19));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, new StringTextComponent("D#"), sound, 1.7F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, new StringTextComponent("D#"), sound, 1.7F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(21)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(21));
})); }));
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, new StringTextComponent("F#"), sound, 2.0F, Type.BLACK, () -> container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, new StringTextComponent("F#"), sound, 2.0F, Type.BLACK, () ->
{ {
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(24)); CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(24));
})); }));
} }
} }

View File

@@ -120,12 +120,12 @@ public class ContentPotions extends ContentChild
})); }));
container.add(new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove"), () -> container.add(new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove"), () ->
{ {
CommandHelper.sendCommand(this.builderPotion.getRemoveCommand()); CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.getRemoveCommand());
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove_all"), () -> container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove_all"), () ->
{ {
CommandHelper.sendCommand(this.builderPotion.getClearCommand()); CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.getClearCommand());
container.func_231160_c_(); container.func_231160_c_();
})); }));
} }
@@ -174,31 +174,31 @@ public class ContentPotions extends ContentChild
{ {
container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect"), () -> container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect"), () ->
{ {
CommandHelper.sendCommand(this.builderPotion.getGiveCommand()); CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.getGiveCommand());
this.potionPage = 0; this.potionPage = 0;
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button2 = new GuiButtonBase(x + 118, y + 24, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.tipped_arrow"), () -> container.add(button2 = new GuiButtonBase(x + 118, y + 24, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.tipped_arrow"), () ->
{ {
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.TIPPED_ARROW)); CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.TIPPED_ARROW));
this.potionPage = 0; this.potionPage = 0;
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.bottle"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> container.add(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.bottle"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
{ {
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.POTION)); CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.POTION));
this.potionPage = 0; this.potionPage = 0;
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.splash"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> container.add(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.splash"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
{ {
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.SPLASH_POTION)); CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.SPLASH_POTION));
this.potionPage = 0; this.potionPage = 0;
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.lingering"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> container.add(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.lingering"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
{ {
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.LINGERING_POTION)); CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.LINGERING_POTION));
this.potionPage = 0; this.potionPage = 0;
container.func_231160_c_(); container.func_231160_c_();
})); }));

View File

@@ -96,12 +96,12 @@ public class ContentRecipes extends Content
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.give"), () -> container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.give"), () ->
{ {
CommandHelper.sendCommand(this.builderRecipe.getBuilderForMode(EnumMode.GIVE)); CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe.getBuilderForMode(EnumMode.GIVE));
container.initButtons(); container.initButtons();
})); }));
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.take"), () -> container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.take"), () ->
{ {
CommandHelper.sendCommand(this.builderRecipe.getBuilderForMode(EnumMode.TAKE)); CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe.getBuilderForMode(EnumMode.TAKE));
container.initButtons(); container.initButtons();
})); }));
} }

View File

@@ -259,7 +259,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
{ {
CommandHelper.sendCommand(this.builderObjectives); CommandHelper.sendCommand(container.getPlayer(), this.builderObjectives);
container.func_231160_c_(); container.func_231160_c_();
})); }));
button1.field_230693_o_ = Page.UNDISPLAY.equals(this.page) || ContentScoreboard.isObjectiveValid(); button1.field_230693_o_ = Page.UNDISPLAY.equals(this.page) || ContentScoreboard.isObjectiveValid();

View File

@@ -142,17 +142,17 @@ public class ContentScoreboardPlayers extends ContentScoreboard
}))); })));
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () -> container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
{ {
CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.ADD)); CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForPoints(EnumMode.ADD));
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () -> container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
{ {
CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.REMOVE)); CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForPoints(EnumMode.REMOVE));
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset"), new TranslationTextComponent("gui.worldhandler.actions.set_to_0"), () -> container.add(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset"), new TranslationTextComponent("gui.worldhandler.actions.set_to_0"), () ->
{ {
CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.SET, 0)); CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForPoints(EnumMode.SET, 0));
container.func_231160_c_(); container.func_231160_c_();
})); }));
@@ -166,12 +166,12 @@ public class ContentScoreboardPlayers extends ContentScoreboard
{ {
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
{ {
CommandHelper.sendCommand(this.builderTag.getBuilderForMode(BuilderTag.EnumMode.ADD)); CommandHelper.sendCommand(container.getPlayer(), this.builderTag.getBuilderForMode(BuilderTag.EnumMode.ADD));
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () -> container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
{ {
CommandHelper.sendCommand(this.builderTag.getBuilderForMode(BuilderTag.EnumMode.REMOVE)); CommandHelper.sendCommand(container.getPlayer(), this.builderTag.getBuilderForMode(BuilderTag.EnumMode.REMOVE));
container.func_231160_c_(); container.func_231160_c_();
})); }));
@@ -188,17 +188,17 @@ public class ContentScoreboardPlayers extends ContentScoreboard
}))); })));
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () -> container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
{ {
CommandHelper.sendCommand(this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.ADD)); CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.ADD));
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () -> container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () ->
{ {
CommandHelper.sendCommand(this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.SET)); CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.SET));
container.func_231160_c_(); container.func_231160_c_();
})); }));
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
{ {
CommandHelper.sendCommand(this.builderPlayers.getBuilderForEnable()); CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForEnable());
container.func_231160_c_(); container.func_231160_c_();
})); }));

View File

@@ -160,12 +160,12 @@ public class ContentScoreboardTeams extends ContentScoreboard
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.join"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.join"), () ->
{ {
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.JOIN)); CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.getBuilderForMode(EnumMode.JOIN));
container.initButtons(); container.initButtons();
})); }));
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.leave"), () -> container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.leave"), () ->
{ {
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.LEAVE)); CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.getBuilderForMode(EnumMode.LEAVE));
container.initButtons(); container.initButtons();
})); }));
@@ -175,12 +175,12 @@ public class ContentScoreboardTeams extends ContentScoreboard
{ {
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.remove"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.remove"), () ->
{ {
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.REMOVE)); CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.getBuilderForMode(EnumMode.REMOVE));
container.initButtons(); container.initButtons();
})); }));
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.empty"), () -> container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.empty"), () ->
{ {
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.EMPTY)); CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.getBuilderForMode(EnumMode.EMPTY));
container.initButtons(); container.initButtons();
})); }));
@@ -192,7 +192,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
{ {
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () -> container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
{ {
CommandHelper.sendCommand(this.builderTeams); CommandHelper.sendCommand(container.getPlayer(), this.builderTeams);
container.initButtons(); container.initButtons();
})); }));
button1.field_230693_o_ = enabled; button1.field_230693_o_ = enabled;

View File

@@ -140,7 +140,7 @@ public class ContentSignEditor extends Content
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container))); container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
{ {
CommandHelper.sendCommand(this.builderSignEditor, this.builderSignEditor.isSpecial()); CommandHelper.sendCommand(container.getPlayer(), this.builderSignEditor, this.builderSignEditor.isSpecial());
})); }));
} }

View File

@@ -280,11 +280,11 @@ public class ContentSummon extends Content
if(!this.builderSummon.needsCommandBlock() && !this.builderSummon.getCustomName().isSpecial()) if(!this.builderSummon.needsCommandBlock() && !this.builderSummon.getCustomName().isSpecial())
{ {
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.title.entities.summon"), this::send)); container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.title.entities.summon"), () -> this.send(container.getPlayer())));
} }
else else
{ {
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), this::send)); container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> this.send(container.getPlayer())));
} }
button3.field_230693_o_ = ForgeRegistries.ENTITIES.containsKey(this.builderSummon.getEntity()); button3.field_230693_o_ = ForgeRegistries.ENTITIES.containsKey(this.builderSummon.getEntity());
@@ -392,9 +392,9 @@ public class ContentSummon extends Content
} }
} }
private void send() private void send(String player)
{ {
CommandHelper.sendCommand(this.builderSummon, this.builderSummon.getCustomName().isSpecial()); CommandHelper.sendCommand(player, this.builderSummon, this.builderSummon.getCustomName().isSpecial());
} }
@Override @Override

View File

@@ -3,6 +3,7 @@ package exopandora.worldhandler.usercontent.factory;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -34,13 +35,13 @@ public class ActionHandlerFactory
} }
@Nullable @Nullable
public ActionHandler createActionHandler(Content content, Action action) public ActionHandler createActionHandler(Content content, Action action, Supplier<String> player)
{ {
return this.createActionHandler(content, action, null); return this.createActionHandler(content, action, player, null);
} }
@Nullable @Nullable
public ActionHandler createActionHandler(Content content, Action action, String value) public ActionHandler createActionHandler(Content content, Action action, Supplier<String> player, String value)
{ {
if(action == null) if(action == null)
{ {
@@ -76,7 +77,7 @@ public class ActionHandlerFactory
{ {
if(action.getAttributes().getValue() == null) if(action.getAttributes().getValue() == null)
{ {
CommandHelper.sendCommand(this.builders.get(action.getAttributes().getCommand()).getObject()); CommandHelper.sendCommand(player.get(), this.builders.get(action.getAttributes().getCommand()).getObject());
} }
else if(!action.getAttributes().getValue().isEmpty()) else if(!action.getAttributes().getValue().isEmpty())
{ {

View File

@@ -46,7 +46,7 @@ public class ButtonFactory extends WidgetFactory
button.getDimensions().getHeight(), button.getDimensions().getHeight(),
TextUtils.formatNonnull(button.getText()), TextUtils.formatNonnull(button.getText()),
TextUtils.formatNonnull(button.getAttributes() != null ? button.getAttributes().getTooltip() : null), TextUtils.formatNonnull(button.getAttributes() != null ? button.getAttributes().getTooltip() : null),
this.getActionHandlerFactory().createActionHandler(content, button.getAction()) this.getActionHandlerFactory().createActionHandler(content, button.getAction(), container::getPlayer)
); );
} }
else if(JsonButton.Type.ITEM_BUTTON.equals(button.getType())) else if(JsonButton.Type.ITEM_BUTTON.equals(button.getType()))
@@ -58,7 +58,7 @@ public class ButtonFactory extends WidgetFactory
button.getDimensions().getWidth(), button.getDimensions().getWidth(),
button.getDimensions().getHeight(), button.getDimensions().getHeight(),
ForgeRegistries.ITEMS.getValue(new ResourceLocation(button.getAttributes().getItem())), ForgeRegistries.ITEMS.getValue(new ResourceLocation(button.getAttributes().getItem())),
this.getActionHandlerFactory().createActionHandler(content, button.getAction()) this.getActionHandlerFactory().createActionHandler(content, button.getAction(), container::getPlayer)
); );
} }
else if(JsonButton.Type.ICON_BUTTON.equals(button.getType())) else if(JsonButton.Type.ICON_BUTTON.equals(button.getType()))
@@ -71,7 +71,7 @@ public class ButtonFactory extends WidgetFactory
button.getDimensions().getHeight(), button.getDimensions().getHeight(),
button.getAttributes().getIcon(), button.getAttributes().getIcon(),
TextUtils.formatNonnull(button.getAttributes().getTooltip()), TextUtils.formatNonnull(button.getAttributes().getTooltip()),
this.getActionHandlerFactory().createActionHandler(content, button.getAction()) this.getActionHandlerFactory().createActionHandler(content, button.getAction(), container::getPlayer)
); );
} }
else if(JsonButton.Type.LIST_BUTTON.equals(button.getType())) else if(JsonButton.Type.LIST_BUTTON.equals(button.getType()))
@@ -84,7 +84,7 @@ public class ButtonFactory extends WidgetFactory
button.getDimensions().getWidth(), button.getDimensions().getWidth(),
button.getDimensions().getHeight(), button.getDimensions().getHeight(),
container, container,
new UsercontentLogicMapped<JsonButton.Type>(this.getApi(), this.getActionHandlerFactory(), content, button) new UsercontentLogicMapped<JsonButton.Type>(this.getApi(), this.getActionHandlerFactory(), content, button, container::getPlayer)
); );
} }
else if(JsonButton.Type.SLIDER.equals(button.getType())) else if(JsonButton.Type.SLIDER.equals(button.getType()))

View File

@@ -1,5 +1,7 @@
package exopandora.worldhandler.usercontent.factory; package exopandora.worldhandler.usercontent.factory;
import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import exopandora.worldhandler.gui.button.GuiButtonBase; import exopandora.worldhandler.gui.button.GuiButtonBase;
@@ -40,7 +42,7 @@ public class MenuFactory extends WidgetFactory
menu.getDimensions().getHeight(), menu.getDimensions().getHeight(),
menu.getAttributes().getLength(), menu.getAttributes().getLength(),
container, container,
new UsercontentLogicPageList<JsonMenu.Type>(this.getApi(), this.getActionHandlerFactory(), content, container, menu) new UsercontentLogicPageList<JsonMenu.Type>(this.getApi(), this.getActionHandlerFactory(), content, container, menu, container::getPlayer)
); );
} }
@@ -52,9 +54,9 @@ public class MenuFactory extends WidgetFactory
{ {
private final Container container; private final Container container;
public UsercontentLogicPageList(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, Container container, JsonWidget<T> widget) public UsercontentLogicPageList(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, Container container, JsonWidget<T> widget, Supplier<String> player)
{ {
super(api, actionHandlerFactory, content, widget); super(api, actionHandlerFactory, content, widget, player);
this.container = container; this.container = container;
} }

View File

@@ -1,5 +1,7 @@
package exopandora.worldhandler.usercontent.factory; package exopandora.worldhandler.usercontent.factory;
import java.util.function.Supplier;
import exopandora.worldhandler.WorldHandler; import exopandora.worldhandler.WorldHandler;
import exopandora.worldhandler.gui.content.Content; import exopandora.worldhandler.gui.content.Content;
import exopandora.worldhandler.gui.menu.impl.ILogicMapped; import exopandora.worldhandler.gui.menu.impl.ILogicMapped;
@@ -42,13 +44,15 @@ public abstract class WidgetFactory
private final UsercontentAPI api; private final UsercontentAPI api;
private final Content content; private final Content content;
private final JsonWidget<T> widget; private final JsonWidget<T> widget;
private final Supplier<String> player;
public UsercontentLogicMapped(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, JsonWidget<T> widget) public UsercontentLogicMapped(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, JsonWidget<T> widget, Supplier<String> player)
{ {
this.api = api; this.api = api;
this.actionHandlerFactory = actionHandlerFactory; this.actionHandlerFactory = actionHandlerFactory;
this.content = content; this.content = content;
this.widget = widget; this.widget = widget;
this.player = player;
} }
@Override @Override
@@ -74,7 +78,7 @@ public abstract class WidgetFactory
try try
{ {
this.api.updateValue(this.widget.getAttributes().getId(), item.getId()); this.api.updateValue(this.widget.getAttributes().getId(), item.getId());
ActionHandler action = this.actionHandlerFactory.createActionHandler(this.content, this.widget.getAction(), item.getId()); ActionHandler action = this.actionHandlerFactory.createActionHandler(this.content, this.widget.getAction(), this.player, item.getId());
if(action != null) if(action != null)
{ {

View File

@@ -76,77 +76,77 @@ public class ActionHelper
public static void timeDawn() public static void timeDawn()
{ {
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getDawn())); CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getDawn()));
} }
public static void timeNoon() public static void timeNoon()
{ {
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getNoon())); CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getNoon()));
} }
public static void timeSunset() public static void timeSunset()
{ {
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getSunset())); CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getSunset()));
} }
public static void timeMidnight() public static void timeMidnight()
{ {
CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight())); CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight()));
} }
public static void weatherClear() public static void weatherClear()
{ {
CommandHelper.sendCommand(new BuilderWeather(EnumWeather.CLEAR)); CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.CLEAR));
} }
public static void weatherRain() public static void weatherRain()
{ {
CommandHelper.sendCommand(new BuilderWeather(EnumWeather.RAIN)); CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.RAIN));
} }
public static void weatherThunder() public static void weatherThunder()
{ {
CommandHelper.sendCommand(new BuilderWeather(EnumWeather.THUNDER)); CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.THUNDER));
} }
public static void difficultyPeaceful() public static void difficultyPeaceful()
{ {
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.PEACEFUL)); CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.PEACEFUL));
} }
public static void difficultyEasy() public static void difficultyEasy()
{ {
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.EASY)); CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.EASY));
} }
public static void difficultyNormal() public static void difficultyNormal()
{ {
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.NORMAL)); CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.NORMAL));
} }
public static void difficultyHard() public static void difficultyHard()
{ {
CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.HARD)); CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.HARD));
} }
public static void gamemodeSurvival() public static void gamemodeSurvival()
{ {
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.SURVIVAL)); CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.SURVIVAL));
} }
public static void gamemodeCreative() public static void gamemodeCreative()
{ {
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.CREATIVE)); CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.CREATIVE));
} }
public static void gamemodeAdventure() public static void gamemodeAdventure()
{ {
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.ADVENTURE)); CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.ADVENTURE));
} }
public static void gamemodeSpectator() public static void gamemodeSpectator()
{ {
CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.SPECTATOR)); CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.SPECTATOR));
} }
public static void tryRun(ActionHandler action) public static void tryRun(ActionHandler action)

View File

@@ -146,7 +146,7 @@ public class BlockHelper
POS_2_OBSERVERS.add(observer); POS_2_OBSERVERS.add(observer);
} }
public static boolean setCommandBlockNearPlayer(String command) public static boolean setCommandBlockNearPlayer(String player, String command)
{ {
if(CommandHelper.canPlayerIssueCommand() && Minecraft.getInstance().getConnection() != null) if(CommandHelper.canPlayerIssueCommand() && Minecraft.getInstance().getConnection() != null)
{ {
@@ -170,7 +170,7 @@ public class BlockHelper
BuilderExecute wrapped = new BuilderExecute(); BuilderExecute wrapped = new BuilderExecute();
wrapped.setMode1(EnumMode.AT); wrapped.setMode1(EnumMode.AT);
wrapped.setTarget(Minecraft.getInstance().player.getGameProfile().getName()); wrapped.setTarget(player);
wrapped.setMode2(EnumMode.RUN); wrapped.setMode2(EnumMode.RUN);
wrapped.setCommand(command); wrapped.setCommand(command);
@@ -183,10 +183,10 @@ public class BlockHelper
return false; return false;
} }
public static void setBlockNearPlayer(Block block) public static void setBlockNearPlayer(String player, Block block) //TODO usage
{ {
BuilderSetBlock builder = new BuilderSetBlock(new CoordinateInt(EnumType.LOCAL), new CoordinateInt(EnumType.LOCAL), new CoordinateInt(2, EnumType.LOCAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode()); BuilderSetBlock builder = new BuilderSetBlock(new CoordinateInt(EnumType.LOCAL), new CoordinateInt(EnumType.LOCAL), new CoordinateInt(2, EnumType.LOCAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode());
builder.setState(BlockStateProperties.HORIZONTAL_FACING, Minecraft.getInstance().player.getHorizontalFacing().getOpposite()); builder.setState(BlockStateProperties.HORIZONTAL_FACING, Minecraft.getInstance().player.getHorizontalFacing().getOpposite());
CommandHelper.sendCommand(builder); CommandHelper.sendCommand(player, builder);
} }
} }

View File

@@ -32,13 +32,13 @@ public class CommandHelper
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void sendCommand(ICommandBuilder builder) public static void sendCommand(String player, ICommandBuilder builder)
{ {
CommandHelper.sendCommand(builder, false); CommandHelper.sendCommand(player, builder, false);
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void sendCommand(ICommandBuilder builder, boolean special) public static void sendCommand(String player, ICommandBuilder builder, boolean special)
{ {
if(builder != null) if(builder != null)
{ {
@@ -57,7 +57,7 @@ public class CommandHelper
if(builder.needsCommandBlock() || special) if(builder.needsCommandBlock() || special)
{ {
BlockHelper.setCommandBlockNearPlayer(command); BlockHelper.setCommandBlockNearPlayer(player, command);
} }
else else
{ {