Skip to content

Commit

Permalink
Maths Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Funasitien committed Sep 2, 2024
1 parent 37b1185 commit 9581932
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 119 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.democraft</groupId>
<artifactId>DemoCraftMBwLayout</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>

<name>DemoCraftMBwLayout</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,10 @@ public final class DemoCraftMBwLayout extends JavaPlugin implements Listener {

@Override
public void onEnable() {
getLogger().info("DEMOCRAFT's QuickBuy modifier has been enabled!");
getLogger().info("Injecting our malicous editing robot into MBedWars...");
this.saveDefaultConfig();
getServer().getPluginManager().registerEvents(this, this);
GameAPI.get().registerShopLayout(new ShopLayout() {
final DemoShopLayout handler = new DemoShopLayout();

@Override
public String getName() {
return "DemoShopLayout"; // the name within your shop.yml
}

@Override
public boolean isBeta() {
return false;
}

@Override
public JavaPlugin getPlugin() {
return DemoCraftMBwLayout.this;
}

@Override
public ShopLayoutHandler getHandler() {
return this.handler;
}
});
getLogger().info("DEMOCRAFT's QuickBuy modifier has been enabled!");
}

@EventHandler
Expand All @@ -52,10 +31,10 @@ public void onShopGUIPostProcess(ShopGUIPostProcessEvent event) {
ChestGUI chestGui = (ChestGUI) shopGui;

// Define the original and new positions
int originalSlot = 0; // x0, y0 (slot 0)
int newSlot = 1; // x1, y0 (slot 1)
int originalSlot = getConfig().getInt("initial-position");
int newSlot = getConfig().getInt("edited-position");

// Get the item in the original slot (x0, y0)
// Get the item in the original slot
GUIItem itemInQuickSlot = chestGui.getItem(originalSlot);
GUIItem MENU_ENABLED = chestGui.getItem(9);
GUIItem MENU_DISABLED = chestGui.getItem(10);
Expand All @@ -64,7 +43,7 @@ public void onShopGUIPostProcess(ShopGUIPostProcessEvent event) {
if (itemInQuickSlot != null) {
chestGui.setItem(itemInQuickSlot, newSlot); // Set item to new slot
chestGui.setItem(new ItemStack(Material.AIR), originalSlot); // Set item to new slot
chestGui.setItem(MENU_ENABLED, 10); // Set item to new slot
chestGui.setItem(MENU_ENABLED, originalSlot + 9);// Set item to new slot
chestGui.setItem(MENU_DISABLED, 9); // Set item to new slot
}

Expand Down
89 changes: 0 additions & 89 deletions src/main/java/fr/democraft/democraftmbwlayout/DemoShopLayout.java

This file was deleted.

9 changes: 9 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Initial position of the QuickBuy button.
# Unless an update change the HypixelV2 Layout, 0 is the right position
initial-position: 0

# New position that you want to apply to the QB button
# By default 1, but can be ANYTHING
edited-position: 1

# Remember to use force-slot to move other buttons. This module overide any existing
5 changes: 4 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: DemoCraftMBwLayout
version: '${project.version}'
main: fr.democraft.democraftmbwlayout.DemoCraftMBwLayout
api-version: '1.21'
api-version: '1.13'
description: A MBedWars companion plugin that allow server admins to edit the position of the quickbuy button
author: Funasitien
website: https://f.drealclouds.fr
depend: [MBedwars]

0 comments on commit 9581932

Please sign in to comment.