diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentAdvancements.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentAdvancements.java index b14ec1f..49d030e 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentAdvancements.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentAdvancements.java @@ -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"), () -> { - 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"), () -> { - 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), () -> { diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java index bddecb8..ecd5493 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java @@ -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"), () -> { - 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(); @@ -115,7 +115,7 @@ public class ContentButcher extends Content slaughter.field_230693_o_ = enabled; } - public static void slaughter(Collection> entities, int radius) + public static void slaughter(String player, Collection> entities, int 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()) { - CommandHelper.sendCommand(new BuilderButcher(entity.getRegistryName(), radius)); + CommandHelper.sendCommand(player, new BuilderButcher(entity.getRegistryName(), radius)); } } } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java index 965b7f8..950e87c 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcherPresets.java @@ -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"), () -> { - 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())); })); 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())); })); 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())); })); 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())); })); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContainers.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContainers.java index f11f763..7cfa717 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContainers.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContainers.java @@ -34,17 +34,17 @@ public class ContentContainers extends Content 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(); })); 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(); })); 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(); })); 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) { - 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), () -> { - 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), () -> { - 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), () -> { - 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), () -> { - CommandHelper.sendCommand(new BuilderGive(container.getPlayer(), Blocks.ENCHANTING_TABLE.getRegistryName())); + CommandHelper.sendCommand(container.getPlayer(), new BuilderGive(container.getPlayer(), Blocks.ENCHANTING_TABLE.getRegistryName())); })); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContinue.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContinue.java index fa9e05e..8da2e62 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContinue.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentContinue.java @@ -69,7 +69,7 @@ public class ContentContinue extends ContentChild 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), () -> { - CommandHelper.sendCommand(this.builder, this.special); + CommandHelper.sendCommand(container.getPlayer(), this.builder, this.special); 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))); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java index abaefff..08db940 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCustomItem.java @@ -278,19 +278,19 @@ public class ContentCustomItem extends Content 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 { - 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); } - 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 diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEditBlocks.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEditBlocks.java index 9e102de..391bdb1 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEditBlocks.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEditBlocks.java @@ -228,7 +228,7 @@ public class ContentEditBlocks extends Content container.add(this.block1Field); 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); } @@ -246,7 +246,7 @@ public class ContentEditBlocks extends Content container.add(this.block2Field); 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); } @@ -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"), () -> { - CommandHelper.sendCommand(this.builderClone); + CommandHelper.sendCommand(container.getPlayer(), this.builderClone); })); try diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEnchantment.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEnchantment.java index 414bea9..57098ce 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEnchantment.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentEnchantment.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderEnchantment); + CommandHelper.sendCommand(container.getPlayer(), this.builderEnchantment); })); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentExperience.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentExperience.java index e0d0765..e9d9c43 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentExperience.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentExperience.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderExperience.getBuilderForAddLevels()); + CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.getBuilderForAddLevels()); container.func_231160_c_(); })); 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"), () -> { - CommandHelper.sendCommand(this.builderExperience.getBuilderForResetLevels()); + CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.getBuilderForResetLevels()); container.func_231160_c_(); })); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentGamerules.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentGamerules.java index 66fd685..5e75e64 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentGamerules.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentGamerules.java @@ -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"), () -> { - 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"), () -> { - CommandHelper.sendCommand(this.builderGamerule.getBuilderForValue(String.valueOf(false))); + CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule.getBuilderForValue(String.valueOf(false))); })); } else @@ -145,7 +145,7 @@ public class ContentGamerules extends Content container.add(this.valueField); 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); })); } } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMultiplayer.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMultiplayer.java index 51dbaa2..64fbdc5 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMultiplayer.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMultiplayer.java @@ -152,11 +152,11 @@ public class ContentMultiplayer extends Content 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()), () -> { - 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()), () -> { - CommandHelper.sendCommand(this.builderBan); + CommandHelper.sendCommand(container.getPlayer(), this.builderBan); })); if(this.playerField.getText().isEmpty()) @@ -172,7 +172,7 @@ public class ContentMultiplayer extends Content 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()), () -> { - CommandHelper.sendCommand(this.builderPardon); + CommandHelper.sendCommand(container.getPlayer(), this.builderPardon); })); if(this.playerField.getText().isEmpty()) @@ -187,11 +187,11 @@ public class ContentMultiplayer extends Content 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()), () -> { - 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()), () -> { - CommandHelper.sendCommand(this.builderDeop); + CommandHelper.sendCommand(container.getPlayer(), this.builderDeop); })); 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()), () -> { - 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()), () -> { - 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()), () -> { @@ -228,25 +228,25 @@ public class ContentMultiplayer extends Content container.add(this.playerField); 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"), () -> { - 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")), () -> { - 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")), () -> { - 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"), () -> { - CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.RELOAD)); + CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.getBuilder(EnumMode.RELOAD)); })); if(this.playerField.getText().isEmpty()) diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java index 328b9dd..12ae336 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentNoteEditor.java @@ -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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - 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, () -> { - CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(24)); + CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.getBuilderForNote(24)); })); } } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java index 1c03451..0685017 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentPotions.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderPotion.getRemoveCommand()); + CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.getRemoveCommand()); container.func_231160_c_(); })); 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_(); })); } @@ -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"), () -> { - CommandHelper.sendCommand(this.builderPotion.getGiveCommand()); + CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.getGiveCommand()); this.potionPage = 0; container.func_231160_c_(); })); 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; 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"), () -> { - CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.POTION)); + CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.POTION)); this.potionPage = 0; 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"), () -> { - CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.SPLASH_POTION)); + CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.SPLASH_POTION)); this.potionPage = 0; 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"), () -> { - CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.LINGERING_POTION)); + CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.getBuilderForPotion(Items.LINGERING_POTION)); this.potionPage = 0; container.func_231160_c_(); })); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentRecipes.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentRecipes.java index bdfeac8..a8e9fc5 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentRecipes.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentRecipes.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderRecipe.getBuilderForMode(EnumMode.GIVE)); + CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe.getBuilderForMode(EnumMode.GIVE)); container.initButtons(); })); 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(); })); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java index 8a3403d..402f328 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardObjectives.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderObjectives); + CommandHelper.sendCommand(container.getPlayer(), this.builderObjectives); container.func_231160_c_(); })); button1.field_230693_o_ = Page.UNDISPLAY.equals(this.page) || ContentScoreboard.isObjectiveValid(); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardPlayers.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardPlayers.java index 61d456b..7ff84b5 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardPlayers.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardPlayers.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.ADD)); + CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForPoints(EnumMode.ADD)); 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"), () -> { - CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.REMOVE)); + CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForPoints(EnumMode.REMOVE)); 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"), () -> { - CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.SET, 0)); + CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.getBuilderForPoints(EnumMode.SET, 0)); 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"), () -> { - CommandHelper.sendCommand(this.builderTag.getBuilderForMode(BuilderTag.EnumMode.ADD)); + CommandHelper.sendCommand(container.getPlayer(), this.builderTag.getBuilderForMode(BuilderTag.EnumMode.ADD)); container.func_231160_c_(); })); 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_(); })); @@ -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"), () -> { - CommandHelper.sendCommand(this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.ADD)); + CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.ADD)); 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"), () -> { - CommandHelper.sendCommand(this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.SET)); + CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.SET)); container.func_231160_c_(); })); 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_(); })); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardTeams.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardTeams.java index e1d93cb..5604239 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardTeams.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentScoreboardTeams.java @@ -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"), () -> { - CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.JOIN)); + CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.getBuilderForMode(EnumMode.JOIN)); container.initButtons(); })); 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(); })); @@ -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"), () -> { - CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.REMOVE)); + CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.getBuilderForMode(EnumMode.REMOVE)); container.initButtons(); })); 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(); })); @@ -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"), () -> { - CommandHelper.sendCommand(this.builderTeams); + CommandHelper.sendCommand(container.getPlayer(), this.builderTeams); container.initButtons(); })); button1.field_230693_o_ = enabled; diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSignEditor.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSignEditor.java index bdc8e74..ba4bc88 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSignEditor.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSignEditor.java @@ -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 + 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()); })); } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java index 1b4733f..2c317e3 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java @@ -280,11 +280,11 @@ public class ContentSummon extends Content 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 { - 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()); @@ -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 diff --git a/src/main/java/exopandora/worldhandler/usercontent/factory/ActionHandlerFactory.java b/src/main/java/exopandora/worldhandler/usercontent/factory/ActionHandlerFactory.java index c7f6a8d..16ed124 100644 --- a/src/main/java/exopandora/worldhandler/usercontent/factory/ActionHandlerFactory.java +++ b/src/main/java/exopandora/worldhandler/usercontent/factory/ActionHandlerFactory.java @@ -3,6 +3,7 @@ package exopandora.worldhandler.usercontent.factory; import java.util.List; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; import javax.annotation.Nullable; @@ -34,13 +35,13 @@ public class ActionHandlerFactory } @Nullable - public ActionHandler createActionHandler(Content content, Action action) + public ActionHandler createActionHandler(Content content, Action action, Supplier player) { - return this.createActionHandler(content, action, null); + return this.createActionHandler(content, action, player, null); } @Nullable - public ActionHandler createActionHandler(Content content, Action action, String value) + public ActionHandler createActionHandler(Content content, Action action, Supplier player, String value) { if(action == null) { @@ -76,7 +77,7 @@ public class ActionHandlerFactory { 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()) { diff --git a/src/main/java/exopandora/worldhandler/usercontent/factory/ButtonFactory.java b/src/main/java/exopandora/worldhandler/usercontent/factory/ButtonFactory.java index 7384abf..db05078 100644 --- a/src/main/java/exopandora/worldhandler/usercontent/factory/ButtonFactory.java +++ b/src/main/java/exopandora/worldhandler/usercontent/factory/ButtonFactory.java @@ -46,7 +46,7 @@ public class ButtonFactory extends WidgetFactory button.getDimensions().getHeight(), TextUtils.formatNonnull(button.getText()), 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())) @@ -58,7 +58,7 @@ public class ButtonFactory extends WidgetFactory button.getDimensions().getWidth(), button.getDimensions().getHeight(), 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())) @@ -71,7 +71,7 @@ public class ButtonFactory extends WidgetFactory button.getDimensions().getHeight(), button.getAttributes().getIcon(), 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())) @@ -84,7 +84,7 @@ public class ButtonFactory extends WidgetFactory button.getDimensions().getWidth(), button.getDimensions().getHeight(), container, - new UsercontentLogicMapped(this.getApi(), this.getActionHandlerFactory(), content, button) + new UsercontentLogicMapped(this.getApi(), this.getActionHandlerFactory(), content, button, container::getPlayer) ); } else if(JsonButton.Type.SLIDER.equals(button.getType())) diff --git a/src/main/java/exopandora/worldhandler/usercontent/factory/MenuFactory.java b/src/main/java/exopandora/worldhandler/usercontent/factory/MenuFactory.java index 791f9d5..6538daf 100644 --- a/src/main/java/exopandora/worldhandler/usercontent/factory/MenuFactory.java +++ b/src/main/java/exopandora/worldhandler/usercontent/factory/MenuFactory.java @@ -1,5 +1,7 @@ package exopandora.worldhandler.usercontent.factory; +import java.util.function.Supplier; + import javax.annotation.Nullable; import exopandora.worldhandler.gui.button.GuiButtonBase; @@ -40,7 +42,7 @@ public class MenuFactory extends WidgetFactory menu.getDimensions().getHeight(), menu.getAttributes().getLength(), container, - new UsercontentLogicPageList(this.getApi(), this.getActionHandlerFactory(), content, container, menu) + new UsercontentLogicPageList(this.getApi(), this.getActionHandlerFactory(), content, container, menu, container::getPlayer) ); } @@ -52,9 +54,9 @@ public class MenuFactory extends WidgetFactory { private final Container container; - public UsercontentLogicPageList(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, Container container, JsonWidget widget) + public UsercontentLogicPageList(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, Container container, JsonWidget widget, Supplier player) { - super(api, actionHandlerFactory, content, widget); + super(api, actionHandlerFactory, content, widget, player); this.container = container; } diff --git a/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java b/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java index fc4ddf6..f754ec0 100644 --- a/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java +++ b/src/main/java/exopandora/worldhandler/usercontent/factory/WidgetFactory.java @@ -1,5 +1,7 @@ package exopandora.worldhandler.usercontent.factory; +import java.util.function.Supplier; + import exopandora.worldhandler.WorldHandler; import exopandora.worldhandler.gui.content.Content; import exopandora.worldhandler.gui.menu.impl.ILogicMapped; @@ -42,13 +44,15 @@ public abstract class WidgetFactory private final UsercontentAPI api; private final Content content; private final JsonWidget widget; + private final Supplier player; - public UsercontentLogicMapped(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, JsonWidget widget) + public UsercontentLogicMapped(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory, Content content, JsonWidget widget, Supplier player) { this.api = api; this.actionHandlerFactory = actionHandlerFactory; this.content = content; this.widget = widget; + this.player = player; } @Override @@ -74,7 +78,7 @@ public abstract class WidgetFactory try { 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) { diff --git a/src/main/java/exopandora/worldhandler/util/ActionHelper.java b/src/main/java/exopandora/worldhandler/util/ActionHelper.java index 11039fa..b3c0bab 100644 --- a/src/main/java/exopandora/worldhandler/util/ActionHelper.java +++ b/src/main/java/exopandora/worldhandler/util/ActionHelper.java @@ -76,77 +76,77 @@ public class ActionHelper 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() { - CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getNoon())); + CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getNoon())); } 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() { - CommandHelper.sendCommand(new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight())); + CommandHelper.sendCommand(null, new BuilderTime(EnumMode.SET, Config.getSettings().getMidnight())); } public static void weatherClear() { - CommandHelper.sendCommand(new BuilderWeather(EnumWeather.CLEAR)); + CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.CLEAR)); } public static void weatherRain() { - CommandHelper.sendCommand(new BuilderWeather(EnumWeather.RAIN)); + CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.RAIN)); } public static void weatherThunder() { - CommandHelper.sendCommand(new BuilderWeather(EnumWeather.THUNDER)); + CommandHelper.sendCommand(null, new BuilderWeather(EnumWeather.THUNDER)); } public static void difficultyPeaceful() { - CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.PEACEFUL)); + CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.PEACEFUL)); } public static void difficultyEasy() { - CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.EASY)); + CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.EASY)); } public static void difficultyNormal() { - CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.NORMAL)); + CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.NORMAL)); } public static void difficultyHard() { - CommandHelper.sendCommand(new BuilderDifficulty(Difficulty.HARD)); + CommandHelper.sendCommand(null, new BuilderDifficulty(Difficulty.HARD)); } public static void gamemodeSurvival() { - CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.SURVIVAL)); + CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.SURVIVAL)); } public static void gamemodeCreative() { - CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.CREATIVE)); + CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.CREATIVE)); } public static void gamemodeAdventure() { - CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.ADVENTURE)); + CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.ADVENTURE)); } public static void gamemodeSpectator() { - CommandHelper.sendCommand(new BuilderGamemode(EnumGamemode.SPECTATOR)); + CommandHelper.sendCommand(null, new BuilderGamemode(EnumGamemode.SPECTATOR)); } public static void tryRun(ActionHandler action) diff --git a/src/main/java/exopandora/worldhandler/util/BlockHelper.java b/src/main/java/exopandora/worldhandler/util/BlockHelper.java index 0ba4abd..f492bdc 100644 --- a/src/main/java/exopandora/worldhandler/util/BlockHelper.java +++ b/src/main/java/exopandora/worldhandler/util/BlockHelper.java @@ -146,7 +146,7 @@ public class BlockHelper 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) { @@ -170,7 +170,7 @@ public class BlockHelper BuilderExecute wrapped = new BuilderExecute(); wrapped.setMode1(EnumMode.AT); - wrapped.setTarget(Minecraft.getInstance().player.getGameProfile().getName()); + wrapped.setTarget(player); wrapped.setMode2(EnumMode.RUN); wrapped.setCommand(command); @@ -183,10 +183,10 @@ public class BlockHelper 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()); builder.setState(BlockStateProperties.HORIZONTAL_FACING, Minecraft.getInstance().player.getHorizontalFacing().getOpposite()); - CommandHelper.sendCommand(builder); + CommandHelper.sendCommand(player, builder); } } diff --git a/src/main/java/exopandora/worldhandler/util/CommandHelper.java b/src/main/java/exopandora/worldhandler/util/CommandHelper.java index 0f0bcee..50b4891 100644 --- a/src/main/java/exopandora/worldhandler/util/CommandHelper.java +++ b/src/main/java/exopandora/worldhandler/util/CommandHelper.java @@ -32,13 +32,13 @@ public class CommandHelper } @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) - public static void sendCommand(ICommandBuilder builder, boolean special) + public static void sendCommand(String player, ICommandBuilder builder, boolean special) { if(builder != null) { @@ -57,7 +57,7 @@ public class CommandHelper if(builder.needsCommandBlock() || special) { - BlockHelper.setCommandBlockNearPlayer(command); + BlockHelper.setCommandBlockNearPlayer(player, command); } else {