Skip to content

Commit

Permalink
Merge pull request #5 from NiklasEi/gamebox-3
Browse files Browse the repository at this point in the history
Gamebox v3
  • Loading branch information
NiklasEi committed Apr 4, 2020
2 parents e3d0ac0 + 11b2338 commit a72cecf
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 60 deletions.
74 changes: 62 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,62 @@

<groupId>me.nikl.gamebox.games</groupId>
<artifactId>2048</artifactId>
<version>2.1.1</version>
<name>2048</name>
<packaging>jar</packaging>
<version>3.0.0-beta</version>
<description>Combine tiles to reach ever greater numbers</description>

<distributionManagement>
<repository>
<id>nikl-repo</id>
<url>http://repo.nikl.me/artifactory/public</url>
</repository>
</distributionManagement>

<scm>
<url>https://github.com/NiklasEi/2048-for-gamebox</url>
<connection>[email protected]:NiklasEi/2048-for-gamebox.git</connection>
</scm>

<build>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.name}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<directory>target</directory>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create-timestamp</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
Expand All @@ -15,35 +70,30 @@
</repository>
<repository>
<id>nikl-repo</id>
<url>https://repo.nikl.me/artifactory/repositories</url>
<url>http://repo.nikl.me/artifactory/public</url>
</repository>
</repositories>

<dependencies>
<!--Bukkit API-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<version>1.14.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- GameBox -->
<dependency>
<groupId>me.nikl</groupId>
<artifactId>gamebox</artifactId>
<version>2.0.0</version>
<version>${gamebox.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.artifactId}</finalName>
</build>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<gamebox.version>3.0.0-beta.2</gamebox.version>
</properties>
</project>
</project>
26 changes: 9 additions & 17 deletions src/main/java/me/nikl/gamebox/games/TofeMain.java
Original file line number Diff line number Diff line change
@@ -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() {

}
}
3 changes: 0 additions & 3 deletions src/main/java/me/nikl/gamebox/games/twoofoureight/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public Game(GameRules rule, Tofe tofe, Player player, Map<Integer, ItemStack> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}
Expand Down
42 changes: 21 additions & 21 deletions src/main/resources/games/twoofoureight/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +25,7 @@ gameBox:
- "&1Shift dem tiles and add 'em up"
gameButtons:
normal:
materialData: "WOOL:13"
materialData: "GREEN_WOOL"
displayName: "&a&l2048"
lore:
- ""
Expand Down Expand Up @@ -56,7 +56,7 @@ gameBox:
money: 20
tokens: 1
saveStats:
materialData: "stained_clay:3"
materialData: "LIGHT_BLUE_CONCRETE"
displayName: "&a&lCompetition"
lore:
- ""
Expand Down Expand Up @@ -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:
- ""
Expand All @@ -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
Expand All @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/module.yml
Original file line number Diff line number Diff line change
@@ -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}"
6 changes: 0 additions & 6 deletions src/main/resources/plugin.yml

This file was deleted.

0 comments on commit a72cecf

Please sign in to comment.