Skip to content

Commit 7e6be15

Browse files
authored
Merge pull request #1 from WeLoveOpenSourcePlugins/development
Update to 1.16
2 parents f9c9e4a + b7691ee commit 7e6be15

13 files changed

Lines changed: 206 additions & 103 deletions

File tree

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
# Memory Plugin for Minecraft
2-
--------------------------------------------------
32
You have a boring serverlobby or just want to play memory in minecraft?
43
Try our version of memory in minecraft,
54
because our plugin brings variety in your serverlobby.
5+
66
## Features
77
* unique minigame
88
* awesome gui with beautiful animations
99
* easy to configure
1010
* works out of the box
1111
* varying themes
12+
1213
## Setup
13-
* Put the [`Memory.jar`](https://www.spigotmc.org/resources/45082/download?version=176527) in your plugin folder
14-
* Start the server and wait until the message file was created
14+
* Put the [`memory.jar`](https://github.com/WeLoveOpenSourcePlugins/memory/releases/latest) in your plugin folder
15+
* Start the server and wait until the message file got created
1516
* Customize the messages (messages.yml)
16-
* Start you're server again and connect
17+
* Start your server again and connect
18+
1719
## How to play
1820
Right-click the customized block (default: noteblock) to join the queue or use /memory. If a second player joins the queue, the game will start.
1921
Leave the game by closing the inventory.
2022

2123
## Configuration
2224
##### config.yml
23-
----------------
24-
```
25+
26+
```yaml
2527
join_per_block: false
26-
join_block_id: '25:0'
28+
join_block: 'NOTE_BLOCK'
2729
```
30+
2831
##### messages.yml
29-
----------------
30-
```
32+
33+
```yaml
3134
tag: '&8[&eMemory&8]'
3235
game:
3336
against: '%tag% &7You are playing against &e%player%&7.'
@@ -45,11 +48,18 @@ result:
4548
draw: '%tag% &eDraw! - Nobody won.'
4649
win: '%tag% &e%player% has won the game. (%score% pairs)'
4750
```
51+
4852
## Pictures
4953
[![YouTube Gameplay](https://img.youtube.com/vi/-aDJW23rj88/0.jpg)](http://www.youtube.com/watch?v=-aDJW23rj88)
5054
![Queue](https://image.prntscr.com/image/NN0lUvmUTcyjvZx91S-WYw.png)
5155
![GUI](https://image.prntscr.com/image/EUy4z29UT0GKME8PcWXpYQ.png)
5256
-----------------------------
57+
5358
## Problems during installation?
54-
Just write a PM to [@Paul2708](https://www.spigotmc.org/members/paul2708.44827/) on Spigot or contact me via Twitter ([@theplayerpaul](https://twitter.com/theplayerpaul)), Discord or Skype.
55-
Thank you for your attention.
59+
Just write a PM to [@Paul2708](https://www.spigotmc.org/members/paul2708.44827/) on Spigot or contact me via Twitter ([@theplayerpaul](https://twitter.com/theplayerpaul)) or Discord (Paul2708#1098).
60+
Thank you for your attention.
61+
62+
## Contribute
63+
If you find any bugs or want to contribute, just open an issue! We would appreciate it.
64+
65+
> WeLoveOpenSourcePlugins :heart:

pom.xml

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>de.paul2708</groupId>
8-
<artifactId>FuseMemory</artifactId>
9-
<version>1.0-SNAPSHOT</version>
7+
<groupId>de.paul2708.wlosp</groupId>
8+
<artifactId>memory</artifactId>
9+
<version>0.0.1-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.target>14</maven.compiler.target>
13+
<maven.compiler.source>14</maven.compiler.source>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
16+
<spigot.version>1.16.1-R0.1-SNAPSHOT</spigot.version>
17+
</properties>
1018

1119
<repositories>
1220
<repository>
@@ -16,33 +24,21 @@
1624
</repositories>
1725

1826
<dependencies>
19-
<!-- Spigot API -->
2027
<dependency>
2128
<groupId>org.spigotmc</groupId>
2229
<artifactId>spigot-api</artifactId>
23-
<version>1.8.8-R0.1-SNAPSHOT</version>
30+
<version>${spigot.version}</version>
2431
<scope>provided</scope>
2532
</dependency>
2633
</dependencies>
2734

2835
<build>
2936
<plugins>
30-
<!-- Compiler -->
31-
<plugin>
32-
<groupId>org.apache.maven.plugins</groupId>
33-
<artifactId>maven-compiler-plugin</artifactId>
34-
<version>2.3.2</version>
35-
<configuration>
36-
<source>1.8</source>
37-
<target>1.8</target>
38-
</configuration>
39-
</plugin>
40-
41-
<!-- Shade JAR -->
37+
<!-- Shade -->
4238
<plugin>
4339
<groupId>org.apache.maven.plugins</groupId>
4440
<artifactId>maven-shade-plugin</artifactId>
45-
<version>2.3</version>
41+
<version>3.2.2</version>
4642
<executions>
4743
<execution>
4844
<phase>package</phase>
@@ -51,11 +47,34 @@
5147
</goals>
5248
<configuration>
5349
<createDependencyReducedPom>false</createDependencyReducedPom>
50+
<finalName>memory</finalName>
5451
</configuration>
5552
</execution>
5653
</executions>
5754
</plugin>
55+
<!-- Checkstyle -->
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-checkstyle-plugin</artifactId>
59+
<version>3.1.0</version>
60+
<dependencies>
61+
<dependency>
62+
<groupId>com.puppycrawl.tools</groupId>
63+
<artifactId>checkstyle</artifactId>
64+
<version>8.14</version>
65+
</dependency>
66+
</dependencies>
67+
<executions>
68+
<execution>
69+
<id>validate</id>
70+
<phase>none</phase>
71+
</execution>
72+
</executions>
73+
<configuration>
74+
<configLocation>src/test/resources/checkstyle.xml</configLocation>
75+
<linkXRef>false</linkXRef>
76+
</configuration>
77+
</plugin>
5878
</plugins>
5979
</build>
60-
6180
</project>

src/main/java/de/paul2708/memory/file/ConfigFile.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import de.paul2708.memory.Memory;
44
import de.paul2708.memory.util.Constants;
5+
import org.bukkit.Material;
56
import org.bukkit.configuration.file.YamlConfiguration;
67

78
import java.io.File;
@@ -54,7 +55,7 @@ public void load() {
5455

5556
private void createDefaultValues() {
5657
configuration.set("join_per_block", true);
57-
configuration.set("join_block_id", "25:0");
58+
configuration.set("join_block", Material.NOTE_BLOCK.toString().toUpperCase());
5859

5960
try {
6061
configuration.save(configFile);
@@ -67,7 +68,7 @@ public boolean canJoinPerBlock() {
6768
return configuration.getBoolean("join_per_block");
6869
}
6970

70-
public String getBlockId() {
71-
return configuration.getString("join_block_id");
71+
public String getMaterialType() {
72+
return configuration.getString("join_block");
7273
}
7374
}

src/main/java/de/paul2708/memory/game/GameManager.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public class GameManager {
2323

2424
private boolean joinPerBlock;
2525
private Material material;
26-
private byte subId;
2726

2827
public GameManager() {
2928
this.games = new ArrayList<>();
@@ -32,14 +31,7 @@ public GameManager() {
3231
this.queue = new Queue();
3332

3433
this.joinPerBlock = Memory.getConfigFile().canJoinPerBlock();
35-
String sId = Memory.getConfigFile().getBlockId();
36-
if (sId.contains(":")) {
37-
this.material = Material.getMaterial(Integer.valueOf(sId.split(":")[0]));
38-
this.subId = Byte.valueOf(sId.split(":")[1]);
39-
} else {
40-
this.material = Material.getMaterial(Integer.valueOf(sId));
41-
this.subId = (byte) 0;
42-
}
34+
this.material = Material.valueOf(Memory.getConfigFile().getMaterialType());
4335

4436
// Themes
4537
themes.add(new ClassicTheme());
@@ -51,9 +43,9 @@ public Theme getRandomTheme() {
5143
}
5244

5345
public Game getGame(Player p) {
54-
for(Game all : games) {
55-
for(Player gPlayer : all.getPlayers()) {
56-
if(gPlayer.getName().equals(p.getName())) {
46+
for (Game all : games) {
47+
for (Player gPlayer : all.getPlayers()) {
48+
if (gPlayer.getName().equals(p.getName())) {
5749
return all;
5850
}
5951
}
@@ -82,8 +74,4 @@ public boolean canJoinPerBlock() {
8274
public Material getMaterial() {
8375
return material;
8476
}
85-
86-
public byte getSubId() {
87-
return subId;
88-
}
89-
}
77+
}

src/main/java/de/paul2708/memory/listener/InventoryClickListener.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public void onClick(InventoryClickEvent e) {
2929
if (game != null) {
3030
e.setCancelled(true);
3131

32-
if (e.getClickedInventory() == null || e.getClickedInventory().getTitle() == null ||
33-
!e.getClickedInventory().getTitle().contains(player.getName())) {
32+
if (e.getClickedInventory() == null || !e.getView().getTitle().contains(player.getName())) {
3433
return;
3534
}
3635
if (e.getAction() == InventoryAction.PICKUP_ALL || e.getAction() == InventoryAction.PICKUP_HALF) {

src/main/java/de/paul2708/memory/listener/PlayerInteractListener.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public void onInteract(PlayerInteractEvent e) {
2525
if (!Memory.getGameManager().canJoinPerBlock()) {
2626
return;
2727
}
28-
if (block.getType() == Memory.getGameManager().getMaterial() &&
29-
block.getData() == Memory.getGameManager().getSubId()) {
28+
if (block.getType() == Memory.getGameManager().getMaterial()) {
3029
e.setCancelled(true);
3130

3231
Queue queue = Memory.getGameManager().getQueue();

src/main/java/de/paul2708/memory/theme/ClassicTheme.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ public ItemStack[] getPairs() {
3838
new ItemBuilder().name("Zucker").type(Material.SUGAR).getItem(),
3939
};*/
4040
return new ItemStack[] {
41-
new ItemBuilder().id(351).subID(13).getItem(),
42-
new ItemBuilder().id(351).subID(8).getItem(),
43-
new ItemBuilder().id(351).subID(1).getItem(),
44-
new ItemBuilder().type(Material.SULPHUR).getItem(),
41+
new ItemBuilder().type(Material.MAGENTA_DYE).getItem(),
42+
new ItemBuilder().type(Material.GRAY_DYE).getItem(),
43+
new ItemBuilder().type(Material.RED_DYE).getItem(),
44+
new ItemBuilder().type(Material.GUNPOWDER).getItem(),
4545
new ItemBuilder().type(Material.GLOWSTONE_DUST).getItem(),
46-
new ItemBuilder().id(351).subID(2).getItem(),
46+
new ItemBuilder().type(Material.GREEN_DYE).getItem(),
4747
new ItemBuilder().type(Material.FLINT).getItem(),
48-
new ItemBuilder().id(351).subID(10).getItem(),
49-
new ItemBuilder().id(351).subID(12).getItem(),
50-
new ItemBuilder().id(351).subID(14).getItem(),
51-
new ItemBuilder().id(351).subID(9).getItem(),
52-
new ItemBuilder().id(351).subID(5).getItem(),
53-
new ItemBuilder().id(351).subID(4).getItem(),
48+
new ItemBuilder().type(Material.LIME_DYE).getItem(),
49+
new ItemBuilder().type(Material.LIGHT_BLUE_DYE).getItem(),
50+
new ItemBuilder().type(Material.ORANGE_DYE).getItem(),
51+
new ItemBuilder().type(Material.PINK_DYE).getItem(),
52+
new ItemBuilder().type(Material.PURPLE_DYE).getItem(),
53+
new ItemBuilder().type(Material.LAPIS_LAZULI).getItem(),
5454
new ItemBuilder().type(Material.SUGAR).getItem(),
5555
};
5656
}

src/main/java/de/paul2708/memory/theme/FoodTheme.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ public ItemStack[] getPairs() {
3838
new ItemBuilder().name("Roher Kabeljau").type(Material.RAW_FISH).getItem(),
3939
};*/
4040
return new ItemStack[] {
41-
new ItemBuilder().id(297).getItem(),
42-
new ItemBuilder().id(412).getItem(),
43-
new ItemBuilder().id(392).getItem(),
41+
new ItemBuilder().type(Material.BREAD).getItem(),
42+
new ItemBuilder().type(Material.COOKED_RABBIT).getItem(),
43+
new ItemBuilder().type(Material.POTATO).getItem(),
4444
new ItemBuilder().type(Material.COOKED_BEEF).getItem(),
45-
new ItemBuilder().id(391).getItem(),
46-
new ItemBuilder().id(354).getItem(),
47-
new ItemBuilder().id(349).subID(2).getItem(),
48-
new ItemBuilder().id(260).getItem(),
49-
new ItemBuilder().id(424).getItem(),
50-
new ItemBuilder().id(393).getItem(),
51-
new ItemBuilder().id(320).getItem(),
52-
new ItemBuilder().id(357).getItem(),
53-
new ItemBuilder().id(349).subID(3).getItem(),
54-
new ItemBuilder().type(Material.RAW_FISH).getItem(),
45+
new ItemBuilder().type(Material.CARROT).getItem(),
46+
new ItemBuilder().type(Material.CAKE).getItem(),
47+
new ItemBuilder().type(Material.TROPICAL_FISH).getItem(),
48+
new ItemBuilder().type(Material.APPLE).getItem(),
49+
new ItemBuilder().type(Material.COOKED_MUTTON).getItem(),
50+
new ItemBuilder().type(Material.BAKED_POTATO).getItem(),
51+
new ItemBuilder().type(Material.COOKED_PORKCHOP).getItem(),
52+
new ItemBuilder().type(Material.COOKIE).getItem(),
53+
new ItemBuilder().type(Material.PUFFERFISH).getItem(),
54+
new ItemBuilder().type(Material.ENCHANTED_GOLDEN_APPLE).getItem(),
5555
};
5656
}
5757
}

src/main/java/de/paul2708/memory/util/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ public class Constants {
1010

1111
public static final String TAG = "§8[§eMemory§8] §7";
1212

13-
public static final ItemStack COVER = new ItemBuilder().name("?").type(Material.STAINED_GLASS_PANE).subID(0).getItem();
14-
public static final ItemStack BORDER = new ItemBuilder().name("").type(Material.STAINED_GLASS_PANE).subID(15).getItem();
13+
public static final ItemStack COVER = new ItemBuilder().name("?").type(Material.WHITE_STAINED_GLASS_PANE).getItem();
14+
public static final ItemStack BORDER = new ItemBuilder().name("").type(Material.BLACK_STAINED_GLASS_PANE).getItem();
1515
}

src/main/java/de/paul2708/memory/util/ItemBuilder.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,18 @@ public class ItemBuilder {
1818
private String name;
1919
private int amount;
2020
private Material type;
21-
private int subID;
2221
private List<String> description;
2322
private HashMap<Enchantment, Integer> enchantments;
2423

2524
public ItemBuilder() {
2625
this.amount = 1;
27-
this.subID = 0;
2826
this.description = new ArrayList<>();
2927
this.enchantments = new HashMap<>();
3028
}
3129

3230
@SuppressWarnings("deprecation")
3331
public ItemStack getItem() {
34-
ItemStack item = new ItemStack(type.getId(), amount, (short) subID);
32+
ItemStack item = new ItemStack(type, amount);
3533
ItemMeta meta = item.getItemMeta();
3634
if(name != null) meta.setDisplayName(name);
3735
if(description.size() != 0) meta.setLore(description);
@@ -71,15 +69,4 @@ public ItemBuilder type(Material type) {
7169
this.type = type;
7270
return this;
7371
}
74-
75-
@SuppressWarnings("deprecation")
76-
public ItemBuilder id(int id) {
77-
this.type = Material.getMaterial(id);
78-
return this;
79-
}
80-
81-
public ItemBuilder subID(int subID) {
82-
this.subID = subID;
83-
return this;
84-
}
85-
}
72+
}

0 commit comments

Comments
 (0)