From 530ce4dfbdf50933b508555068d15394c9bb8df5 Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Fri, 21 Feb 2020 22:06:02 +0100 Subject: [PATCH 1/2] support mc 1.14 and 1.15 --- pom.xml | 10 ++--- .../games/twoofoureight/GameState.java | 2 +- .../resources/games/twoofoureight/config.yml | 42 +++++++++---------- src/main/resources/plugin.yml | 5 ++- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index da2a90d..97f871c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.nikl.gamebox.games 2048 - 2.1.1 + 3.0.0-alpha @@ -24,14 +24,14 @@ org.bukkit bukkit - 1.12.2-R0.1-SNAPSHOT + 1.14.2-R0.1-SNAPSHOT provided me.nikl - gamebox - 2.0.0 + gamebox-core + 3.0.0-alpha @@ -46,4 +46,4 @@ UTF-8 UTF-8 - \ No newline at end of file + diff --git a/src/main/java/me/nikl/gamebox/games/twoofoureight/GameState.java b/src/main/java/me/nikl/gamebox/games/twoofoureight/GameState.java index f8214cf..63a1193 100644 --- a/src/main/java/me/nikl/gamebox/games/twoofoureight/GameState.java +++ b/src/main/java/me/nikl/gamebox/games/twoofoureight/GameState.java @@ -18,7 +18,7 @@ public void set(int score, Integer[][] grid) { this.grid = new Integer[gridSize][gridSize]; for (int y = 0; y < grid.length; y++) { for (int x = 0; x < grid.length; x++) { - this.grid[x][y] = new Integer(grid[x][y]); + this.grid[x][y] = Integer.valueOf(grid[x][y]); } } } diff --git a/src/main/resources/games/twoofoureight/config.yml b/src/main/resources/games/twoofoureight/config.yml index 367477b..fb9c375 100644 --- a/src/main/resources/games/twoofoureight/config.yml +++ b/src/main/resources/games/twoofoureight/config.yml @@ -16,7 +16,7 @@ langFile: "default" gameBox: mainButton: # define the Material and data for the button (format: 'material:data') - materialData: "stained_clay:11" + materialData: "BLUE_CONCRETE" # display name of the button displayName: "&32048" # lore of the button @@ -25,7 +25,7 @@ gameBox: - "&1Shift dem tiles and add 'em up" gameButtons: normal: - materialData: "WOOL:13" + materialData: "GREEN_WOOL" displayName: "&a&l2048" lore: - "" @@ -56,7 +56,7 @@ gameBox: money: 20 tokens: 1 saveStats: - materialData: "stained_clay:3" + materialData: "LIGHT_BLUE_CONCRETE" displayName: "&a&lCompetition" lore: - "" @@ -89,7 +89,7 @@ gameBox: # use the same key as the game you want to display the top list for # for that button 'saveStats' must be true (see above) saveStats: - materialData: "stained_clay:11" + materialData: "BLUE_CONCRETE" displayName: "&a&lTop list" lore: - "" @@ -112,7 +112,7 @@ rules: # if true the grid will be surrounded with black surroundTheGrid: enable: true - materialData: "stained_glass_pane:15" + materialData: "BLACK_STAINED_GLASS_PANE" displayName: "&a" # undo last move button # this functionality can be turned off on per game mode basis @@ -137,59 +137,59 @@ economy: # 'glow' is an optional boolean tiles: 1: - materialData: "WOOL" + materialData: "WHITE_WOOL" displayName: "&a2" 2: - materialData: "WOOL:1" + materialData: "ORANGE_WOOL" displayName: "&a4" 3: - materialData: "WOOL:4" + materialData: "YELLOW_WOOL" displayName: "&a8" 4: - materialData: "WOOL:5" + materialData: "LIME_WOOL" displayName: "&a16" 5: - materialData: "WOOL:3" + materialData: "LIGHT_BLUE_WOOL" displayName: "&a32" 6: - materialData: "WOOL:2" + materialData: "MAGENTA_WOOL" displayName: "&a64" 7: - materialData: "WOOL:11" + materialData: "BLUE_WOOL" displayName: "&a128" 8: - materialData: "WOOL:13" + materialData: "GREEN_WOOL" displayName: "&a256" 9: - materialData: "stained_clay" + materialData: "WHITE_CONCRETE" displayName: "&a512" glow: true 10: - materialData: "stained_clay:1" + materialData: "ORANGE_CONCRETE" displayName: "&a1024" glow: true 11: - materialData: "stained_clay:4" + materialData: "YELLOW_CONCRETE" displayName: "&a2048" glow: true 12: - materialData: "stained_clay:5" + materialData: "LIME_CONCRETE" displayName: "&a4096" glow: true 13: - materialData: "stained_clay:3" + materialData: "LIGHT_BLUE_CONCRETE" displayName: "&a&l8192" glow: true 14: - materialData: "stained_clay:2" + materialData: "MAGENTA_CONCRETE" displayName: "&a&l16384" glow: true 15: - materialData: "stained_clay:11" + materialData: "BLUE_CONCRETE" displayName: "&a&l32768" glow: true 16: - materialData: "stained_clay:13" + materialData: "GREEN_CONCRETE" displayName: "&a&l65536" glow: true 17: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index dc24169..b8fa58f 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,7 @@ name: 2048 author: Nikl main: me.nikl.gamebox.games.TofeMain -version: 2.1.1 +version: 3.0.0-alpha +api-version: 1.14 website: nikl.me -depend: [GameBox] \ No newline at end of file +depend: [GameBox] From 11b23384d9416f7bb07f6d125f0bcff10cd7a676 Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Thu, 2 Apr 2020 22:51:27 +0200 Subject: [PATCH 2/2] Update to GameBox v3.0.0-beta.2 --- pom.xml | 74 ++++++++++++++++--- .../java/me/nikl/gamebox/games/TofeMain.java | 26 +++---- .../gamebox/games/twoofoureight/Game.java | 3 - src/main/resources/module.yml | 10 +++ src/main/resources/plugin.yml | 7 -- 5 files changed, 81 insertions(+), 39 deletions(-) create mode 100644 src/main/resources/module.yml delete mode 100644 src/main/resources/plugin.yml diff --git a/pom.xml b/pom.xml index 97f871c..218c39e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,62 @@ me.nikl.gamebox.games 2048 - 3.0.0-alpha + 2048 + jar + 3.0.0-beta + Combine tiles to reach ever greater numbers + + + + nikl-repo + http://repo.nikl.me/artifactory/public + + + + + https://github.com/NiklasEi/2048-for-gamebox + git@github.com:NiklasEi/2048-for-gamebox.git + + + + clean package + ${project.name} + src/main/java + target + + + . + true + ${basedir}/src/main/resources + + **/*.yml + + + + + + maven-compiler-plugin + 3.6.0 + + 1.8 + 1.8 + + + + org.codehaus.mojo + buildnumber-maven-plugin + 1.4 + + + validate + + create-timestamp + + + + + + @@ -15,35 +70,30 @@ nikl-repo - https://repo.nikl.me/artifactory/repositories + http://repo.nikl.me/artifactory/public - org.bukkit bukkit - 1.14.2-R0.1-SNAPSHOT + 1.14.1-R0.1-SNAPSHOT provided - me.nikl - gamebox-core - 3.0.0-alpha + gamebox + ${gamebox.version} + provided - - clean package - ${project.artifactId} - - 1.8 1.8 UTF-8 UTF-8 + 3.0.0-beta.2 diff --git a/src/main/java/me/nikl/gamebox/games/TofeMain.java b/src/main/java/me/nikl/gamebox/games/TofeMain.java index 5a58d97..6dcb98b 100644 --- a/src/main/java/me/nikl/gamebox/games/TofeMain.java +++ b/src/main/java/me/nikl/gamebox/games/TofeMain.java @@ -1,31 +1,23 @@ package me.nikl.gamebox.games; -import me.nikl.gamebox.GameBox; -import me.nikl.gamebox.Module; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; +import me.nikl.gamebox.games.twoofoureight.Tofe; +import me.nikl.gamebox.module.GameBoxModule; /** * Created by Niklas on 14.04.2017. * * TofeMain class for the GameBox game 2048 */ -public class TofeMain extends JavaPlugin { - private GameBox gameBox; +public class TofeMain extends GameBoxModule { public static final String TWO_O_FOUR_EIGHT = "twoofoureight"; @Override public void onEnable() { - Plugin plugin = Bukkit.getPluginManager().getPlugin("GameBox"); - if(plugin == null || !plugin.isEnabled()){ - getLogger().warning(" GameBox was not found! Disabling LogicPuzzles..."); - Bukkit.getPluginManager().disablePlugin(this); - return; - } - gameBox = (GameBox) plugin; - new Module(gameBox, TWO_O_FOUR_EIGHT - , "me.nikl.gamebox.games.twoofoureight.Tofe" - , this, TWO_O_FOUR_EIGHT, "2048", "tofe"); + registerGame(TWO_O_FOUR_EIGHT, Tofe.class, "tofe"); + } + + @Override + public void onDisable() { + } } diff --git a/src/main/java/me/nikl/gamebox/games/twoofoureight/Game.java b/src/main/java/me/nikl/gamebox/games/twoofoureight/Game.java index 901cead..75157b5 100644 --- a/src/main/java/me/nikl/gamebox/games/twoofoureight/Game.java +++ b/src/main/java/me/nikl/gamebox/games/twoofoureight/Game.java @@ -60,9 +60,6 @@ public Game(GameRules rule, Tofe tofe, Player player, Map it loadIcons(); String title= lang.GAME_TITLE.replace("%score%", String.valueOf(score)); - if(GameBoxSettings.checkInventoryLength && title.length() > 32){ - title = "Title is too long!"; - } this.inventory = tofe.createInventory(54, title); prepareInventory(topNav, surroundGrid, surroundItemStack); this.lastState = new GameState(gridSize); diff --git a/src/main/resources/module.yml b/src/main/resources/module.yml new file mode 100644 index 0000000..324d1dd --- /dev/null +++ b/src/main/resources/module.yml @@ -0,0 +1,10 @@ +id: ${project.artifactId} +version: ${project.version} +authors: ["Niklas Eicker"] +name: ${project.name} +description: ${project.description} +sourceUrl: ${project.scm.url} +updatedAt: !!java.lang.Long ${timestamp} +dependencies: + - id: gamebox + versionConstrain: ">= ${gamebox.version}" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml deleted file mode 100644 index b8fa58f..0000000 --- a/src/main/resources/plugin.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 2048 -author: Nikl -main: me.nikl.gamebox.games.TofeMain -version: 3.0.0-alpha -api-version: 1.14 -website: nikl.me -depend: [GameBox]