├── .gitignore
├── modules
├── CompatHandler
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ ├── INMSHandler.java
│ │ └── MaterialMapColorInterface.java
├── ServerMinimap
│ ├── .gitignore
│ └── pom.xml
├── compat-1.10
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_10_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.11
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_11_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.12
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_12_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.13.1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_13_R2
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.13
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_13_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.14
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_14_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.15
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_15_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.16.1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_16_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.16.2
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_16_R2
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.16.4
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_16_R3
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.17
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_17_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.18
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_18_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.5
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_5_R3
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.6
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_6_R3
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.7.10
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_7_R4
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.7.5
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_7_R2
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.7.8
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_7_R3
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.7
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_7_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.8.3
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_8_R2
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.8.4
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_8_R3
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.8
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_8_R1
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
├── compat-1.9.4
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── de
│ │ └── craftlancer
│ │ └── serverminimap
│ │ └── nmscompat
│ │ └── v1_9_R2
│ │ ├── MaterialMapColorWrapper.java
│ │ └── NMSHandler.java
└── compat-1.9
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── de
│ └── craftlancer
│ └── serverminimap
│ └── nmscompat
│ └── v1_9_R1
│ ├── MaterialMapColorWrapper.java
│ └── NMSHandler.java
├── pom.xml
└── src
└── main
├── java
└── de
│ └── craftlancer
│ └── serverminimap
│ ├── Coords.java
│ ├── ExtraCursor.java
│ ├── MapChunk.java
│ ├── MinimapCommand.java
│ ├── MinimapRenderer.java
│ ├── OneHandedRenderer.java
│ ├── RenderResult.java
│ ├── RenderTask.java
│ ├── SendTask.java
│ ├── ServerMinimap.java
│ ├── TwoHandedRenderer.java
│ ├── data
│ ├── ConfigHandler.java
│ ├── DataHandler.java
│ └── MySQL.java
│ ├── event
│ ├── MinimapExtraCursorEvent.java
│ └── MinimapPlayerCursorEvent.java
│ └── waypoint
│ ├── Waypoint.java
│ ├── WaypointAddCommand.java
│ ├── WaypointCommandHandler.java
│ ├── WaypointGetIdCommand.java
│ ├── WaypointHandler.java
│ ├── WaypointHelpCommand.java
│ ├── WaypointHideCommand.java
│ ├── WaypointListCommand.java
│ ├── WaypointRemoveCommand.java
│ ├── WaypointSetNameCommand.java
│ └── WaypointSubCommand.java
└── resources
├── config.yml
└── plugin.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 |
3 | /.classpath
4 |
5 | /.project
6 |
7 | /.settings
8 | /target
--------------------------------------------------------------------------------
/modules/CompatHandler/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/CompatHandler/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | API
4 | serverminimap-nmshandler
5 | 4.0.0
6 |
7 |
8 | serverminimap
9 | de.craftlancer
10 | parent
11 | ../../
12 |
13 |
14 |
15 | UTF-8
16 |
17 |
--------------------------------------------------------------------------------
/modules/CompatHandler/src/main/java/de/craftlancer/serverminimap/nmscompat/INMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat;
2 |
3 | import org.bukkit.block.Block;
4 |
5 | public interface INMSHandler
6 | {
7 | public MaterialMapColorInterface getColorNeutral();
8 |
9 | public MaterialMapColorInterface getBlockColor(Block b);
10 |
11 | public boolean hasTwoHands();
12 | }
13 |
--------------------------------------------------------------------------------
/modules/CompatHandler/src/main/java/de/craftlancer/serverminimap/nmscompat/MaterialMapColorInterface.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat;
2 |
3 | public interface MaterialMapColorInterface
4 | {
5 | public int getM();
6 | }
7 |
--------------------------------------------------------------------------------
/modules/ServerMinimap/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 | /.project
3 | /.settings
4 | /target
5 |
--------------------------------------------------------------------------------
/modules/ServerMinimap/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | serverminimap-plugin
4 | de.craftlancer
5 | 0.7.25
6 | ServerMinimap
7 | 4.0.0
8 |
9 |
10 | serverminimap
11 | de.craftlancer
12 | parent
13 | ../../
14 |
15 |
16 |
17 | UTF-8
18 |
19 |
20 |
21 | de.craftlancer
22 | serverminimap-nmshandler
23 | API
24 |
25 |
26 | de.craftlancer
27 | serverminimap-v1.5-R3
28 | v1.5-R3
29 |
30 |
31 | de.craftlancer
32 | serverminimap-v1.6-R3
33 | v1.6-R3
34 |
35 |
36 | de.craftlancer
37 | serverminimap-v1.7-R1
38 | v1.7-R1
39 |
40 |
41 | de.craftlancer
42 | serverminimap-v1.7-R2
43 | v1.7-R2
44 |
45 |
46 | de.craftlancer
47 | serverminimap-v1.7-R3
48 | v1.7-R3
49 |
50 |
51 | de.craftlancer
52 | serverminimap-v1.7-R4
53 | v1.7-R4
54 |
55 |
56 | de.craftlancer
57 | serverminimap-v1.8-R1
58 | v1.8-R1
59 |
60 |
61 | de.craftlancer
62 | serverminimap-v1.8-R2
63 | v1.8-R2
64 |
65 |
66 | de.craftlancer
67 | serverminimap-v1.8-R3
68 | v1.8-R3
69 |
70 |
71 | de.craftlancer
72 | serverminimap-v1.9-R1
73 | v1.9-R1
74 |
75 |
76 | de.craftlancer
77 | serverminimap-v1.9-R2
78 | v1.9-R2
79 |
80 |
81 | de.craftlancer
82 | serverminimap-v1.10-R1
83 | v1.10-R1
84 |
85 |
86 | de.craftlancer
87 | serverminimap-v1.11-R1
88 | v1.11-R1
89 |
90 |
91 | de.craftlancer
92 | serverminimap-v1.12-R1
93 | v1.12-R1
94 |
95 |
96 | de.craftlancer
97 | serverminimap-v1.13-R1
98 | v1.13-R1
99 |
100 |
101 | de.craftlancer
102 | serverminimap-v1.13-R2
103 | v1.13-R2
104 |
105 |
106 | de.craftlancer
107 | serverminimap-v1.14-R1
108 | v1.14-R1
109 |
110 |
111 | de.craftlancer
112 | serverminimap-v1.15-R1
113 | v1.15-R1
114 |
115 |
116 | de.craftlancer
117 | serverminimap-v1.16-R1
118 | v1.16-R1
119 |
120 |
121 | de.craftlancer
122 | serverminimap-v1.16-R2
123 | v1.16-R2
124 |
125 |
126 | de.craftlancer
127 | serverminimap-v1.16-R3
128 | v1.16-R3
129 |
130 |
131 | de.craftlancer
132 | serverminimap-v1.17-R1
133 | v1.17-R1
134 |
135 |
136 | de.craftlancer
137 | serverminimap-v1.18-R1
138 | v1.18-R1
139 |
140 |
141 |
142 |
143 | ../../target
144 | ../../src/main/java
145 |
146 |
147 | ../../src/main/resources
148 | true
149 |
150 |
151 | ${project.name}
152 |
153 |
154 | org.apache.maven.plugins
155 | maven-shade-plugin
156 | 1.4
157 |
158 |
159 | package
160 |
161 | shade
162 |
163 |
164 |
165 |
166 | de.craftlancer:serverminimap*
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------
/modules/compat-1.10/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.10/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.10
7 | serverminimap-v1.10-R1
8 | v1.10-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.10-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.10/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_10_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_10_R1;
2 |
3 | import net.minecraft.server.v1_10_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.10/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_10_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_10_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_10_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_10_R1.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_10_R1.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_10_R1.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_10_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_10_R1.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.r(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return true;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/modules/compat-1.11/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.11/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.11
7 | serverminimap-v1.11-R1
8 | v1.11-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.11-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.11/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_11_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_11_R1;
2 |
3 | import net.minecraft.server.v1_11_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.11/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_11_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_11_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_11_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_11_R1.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_11_R1.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_11_R1.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_11_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_11_R1.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.r(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return true;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/modules/compat-1.12/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.12/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.12
7 | serverminimap-v1.12-R1
8 | v1.12-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.12-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.12/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_12_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_12_R1;
2 |
3 | import net.minecraft.server.v1_12_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.ad;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.12/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_12_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_12_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_12_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_12_R1.BlockPosition;
7 | import net.minecraft.server.v1_12_R1.IBlockAccess;
8 | import net.minecraft.server.v1_12_R1.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_12_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.c);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_12_R1.Block nmsblock = CraftMagicNumbers.getBlock(block);
36 | org.bukkit.craftbukkit.v1_12_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_12_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getBlockData(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.c(data, access, pos);
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.13.1/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.13.1/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.13.1
7 | serverminimap-v1.13-R2
8 | v1.13-R2
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.13.1-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.13.1/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_13_R2/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_13_R2;
2 |
3 | import net.minecraft.server.v1_13_R2.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.ac;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.13.1/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_13_R2/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_13_R2;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_13_R2.MaterialMapColor;
6 | import net.minecraft.server.v1_13_R2.BlockPosition;
7 | import net.minecraft.server.v1_13_R2.IBlockAccess;
8 | import net.minecraft.server.v1_13_R2.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_13_R2.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_13_R2.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_13_R2.CraftChunk w = (org.bukkit.craftbukkit.v1_13_R2.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.c(data, access, pos);
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.13/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.13/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.13
7 | serverminimap-v1.13-R1
8 | v1.13-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.13-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.13/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_13_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_13_R1;
2 |
3 | import net.minecraft.server.v1_13_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.ac;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.13/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_13_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_13_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_13_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_13_R1.BlockPosition;
7 | import net.minecraft.server.v1_13_R1.IBlockAccess;
8 | import net.minecraft.server.v1_13_R1.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_13_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_13_R1.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_13_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_13_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.c(data, access, pos);
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.14/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.14/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.14
7 | serverminimap-v1.14-R1
8 | v1.14-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.14-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.14/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_14_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_14_R1;
2 |
3 | import net.minecraft.server.v1_14_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.ac;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.14/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_14_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_14_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_14_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_14_R1.BlockPosition;
7 | import net.minecraft.server.v1_14_R1.IBlockAccess;
8 | import net.minecraft.server.v1_14_R1.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_14_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_14_R1.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_14_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_14_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.e(data, access, pos);
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.15/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.15/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.15
7 | serverminimap-v1.15-R1
8 | v1.15-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.15-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.15/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_15_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_15_R1;
2 |
3 | import net.minecraft.server.v1_15_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.ac;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.15/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_15_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_15_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_15_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_15_R1.BlockPosition;
7 | import net.minecraft.server.v1_15_R1.IBlockAccess;
8 | import net.minecraft.server.v1_15_R1.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_15_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_15_R1.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_15_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_15_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.e(data, access, pos);
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.16.1/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.16.1/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.16.1
7 | serverminimap-v1.16-R1
8 | v1.16-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.spigotmc
20 | spigot
21 | 1.16.1-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.16.1/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_16_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_16_R1;
2 |
3 | import net.minecraft.server.v1_16_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.aj;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.16.1/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_16_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_16_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_16_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_16_R1.BlockPosition;
7 | import net.minecraft.server.v1_16_R1.IBlockAccess;
8 | import net.minecraft.server.v1_16_R1.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_16_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_16_R1.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_16_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_16_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.s();
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.16.2/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.16.2/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.16.2
7 | serverminimap-v1.16-R2
8 | v1.16-R2
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.spigotmc
20 | spigot
21 | 1.16.3-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.16.2/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_16_R2/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_16_R2;
2 |
3 | import net.minecraft.server.v1_16_R2.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.aj;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.16.2/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_16_R2/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_16_R2;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_16_R2.MaterialMapColor;
6 | import net.minecraft.server.v1_16_R2.BlockPosition;
7 | import net.minecraft.server.v1_16_R2.IBlockAccess;
8 | import net.minecraft.server.v1_16_R2.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_16_R2.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_16_R2.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_16_R2.CraftChunk w = (org.bukkit.craftbukkit.v1_16_R2.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.s();
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.16.4/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.16.4/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.16.4
7 | serverminimap-v1.16-R3
8 | v1.16-R3
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.spigotmc
20 | spigot
21 | 1.16.4-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.16.4/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_16_R3/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_16_R3;
2 |
3 | import net.minecraft.server.v1_16_R3.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.aj;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.16.4/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_16_R3/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_16_R3;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_16_R3.MaterialMapColor;
6 | import net.minecraft.server.v1_16_R3.BlockPosition;
7 | import net.minecraft.server.v1_16_R3.IBlockAccess;
8 | import net.minecraft.server.v1_16_R3.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_16_R3.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.server.v1_16_R3.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_16_R3.CraftChunk w = (org.bukkit.craftbukkit.v1_16_R3.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | @SuppressWarnings("deprecation")
43 | MaterialMapColor nms = nmsblock.s();
44 |
45 | if (!colors.containsKey(nms))
46 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
47 |
48 | return colors.get(nms);
49 | }
50 |
51 | @Override
52 | public boolean hasTwoHands() {
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/modules/compat-1.17/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 | /.project
3 | /.settings
4 | /target
--------------------------------------------------------------------------------
/modules/compat-1.17/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.17
7 | serverminimap-v1.17-R1
8 | v1.17-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.spigotmc
20 | spigot
21 | 1.17-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.17/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_17_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_17_R1;
2 |
3 | import net.minecraft.world.level.material.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.am;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.17/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_17_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_17_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.world.level.material.MaterialMapColor;
6 | import net.minecraft.core.BlockPosition;
7 | import net.minecraft.world.level.IBlockAccess;
8 | import net.minecraft.world.level.block.state.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.a)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.b);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.world.level.block.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_17_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_17_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().getType(pos);
40 | IBlockAccess access = w.getHandle().getWorld();
41 |
42 | MaterialMapColor nms = nmsblock.s();
43 |
44 | if (!colors.containsKey(nms))
45 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
46 |
47 | return colors.get(nms);
48 | }
49 |
50 | @Override
51 | public boolean hasTwoHands() {
52 | return true;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/modules/compat-1.18/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 | /.project
3 | /.settings
4 | /target
--------------------------------------------------------------------------------
/modules/compat-1.18/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.18
7 | serverminimap-v1.18-R1
8 | v1.18-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.spigotmc
20 | spigot
21 | 1.18.1-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.18/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_18_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_18_R1;
2 |
3 | import net.minecraft.world.level.material.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.al;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.18/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_18_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_18_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.world.level.material.MaterialMapColor;
6 | import net.minecraft.core.BlockPosition;
7 | import net.minecraft.world.level.IBlockAccess;
8 | import net.minecraft.world.level.block.state.IBlockData;
9 |
10 | import org.bukkit.Bukkit;
11 | import org.bukkit.block.Block;
12 | import org.bukkit.craftbukkit.v1_18_R1.util.CraftMagicNumbers;
13 |
14 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
15 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
16 |
17 | public class NMSHandler implements INMSHandler
18 | {
19 | private HashMap colors = new HashMap();
20 | {
21 | for(MaterialMapColor color : MaterialMapColor.am)
22 | if(color != null)
23 | colors.put(color, new MaterialMapColorWrapper(color));
24 | }
25 |
26 | @Override
27 | public MaterialMapColorInterface getColorNeutral()
28 | {
29 | return colors.get(MaterialMapColor.a);
30 | }
31 |
32 | @Override
33 | public MaterialMapColorInterface getBlockColor(Block block)
34 | {
35 | net.minecraft.world.level.block.Block nmsblock = CraftMagicNumbers.getBlock(block.getType());
36 | org.bukkit.craftbukkit.v1_18_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_18_R1.CraftChunk) block.getChunk();
37 |
38 | BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
39 | IBlockData data = w.getHandle().a_(pos);
40 | IBlockAccess access = w.getHandle().D();
41 |
42 | MaterialMapColor nms = nmsblock.s();
43 |
44 | if (!colors.containsKey(nms))
45 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
46 |
47 | return colors.get(nms);
48 | }
49 |
50 | @Override
51 | public boolean hasTwoHands() {
52 | return true;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/modules/compat-1.5/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.5/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.5
7 | serverminimap-v1.5-R3
8 | v1.5-R3
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.5.2-R1.0
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.5/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_5_R3/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_5_R3;
2 |
3 | import net.minecraft.server.v1_5_R3.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.q;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/modules/compat-1.5/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_5_R3/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_5_R3;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_5_R3.MaterialMapColor;
6 |
7 | import org.bukkit.Bukkit;
8 | import org.bukkit.block.Block;
9 |
10 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
11 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
12 | import de.craftlancer.serverminimap.nmscompat.v1_5_R3.MaterialMapColorWrapper;
13 |
14 | public class NMSHandler implements INMSHandler
15 | {
16 | private HashMap colors = new HashMap();
17 | {
18 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
19 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
20 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
21 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
22 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
23 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
24 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
25 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
26 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
27 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
28 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
29 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
30 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
31 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
32 | }
33 |
34 | @Override
35 | public MaterialMapColorInterface getColorNeutral()
36 | {
37 | return colors.get(MaterialMapColor.b);
38 | }
39 |
40 | @Override
41 | public MaterialMapColorInterface getBlockColor(Block b)
42 | {
43 | net.minecraft.server.v1_5_R3.Block block = net.minecraft.server.v1_5_R3.Block.byId[b.getTypeId()];
44 |
45 | if (block == null || block.material == null)
46 | return getColorNeutral();
47 |
48 | MaterialMapColor nms = block.material.G;
49 |
50 | if (!colors.containsKey(nms))
51 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
52 |
53 | return colors.get(nms);
54 | }
55 |
56 | @Override
57 | public boolean hasTwoHands() {
58 | return false;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/modules/compat-1.6/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.6/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.6
7 | serverminimap-v1.6-R3
8 | v1.6-R3
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.6.4-R2.0
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.6/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_6_R3/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_6_R3;
2 |
3 | import net.minecraft.server.v1_6_R3.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.q;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/modules/compat-1.6/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_6_R3/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_6_R3;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_6_R3.MaterialMapColor;
6 |
7 | import org.bukkit.Bukkit;
8 | import org.bukkit.block.Block;
9 |
10 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
11 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
12 |
13 | public class NMSHandler implements INMSHandler
14 | {
15 | private HashMap colors = new HashMap();
16 | {
17 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
18 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
19 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
20 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
21 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
22 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
23 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
24 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
25 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
26 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
27 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
28 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
29 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
30 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
31 | }
32 |
33 | @Override
34 | public MaterialMapColorInterface getColorNeutral()
35 | {
36 | return colors.get(MaterialMapColor.b);
37 | }
38 |
39 | @SuppressWarnings("deprecation")
40 | @Override
41 | public MaterialMapColorInterface getBlockColor(Block b)
42 | {
43 | net.minecraft.server.v1_6_R3.Block block = net.minecraft.server.v1_6_R3.Block.byId[b.getTypeId()];
44 |
45 | if (block == null || block.material == null)
46 | return getColorNeutral();
47 |
48 | MaterialMapColor nms = block.material.H;
49 |
50 | if (!colors.containsKey(nms))
51 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
52 |
53 | return colors.get(nms);
54 | }
55 |
56 | @Override
57 | public boolean hasTwoHands() {
58 | return false;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/modules/compat-1.7.10/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.7.10/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.7.10
7 | serverminimap-v1.7-R4
8 | v1.7-R4
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.7.10-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.7.10/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R4/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R4;
2 |
3 | import net.minecraft.server.v1_7_R4.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.7.10/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R4/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R4;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_7_R4.MaterialMapColor;
6 |
7 | import org.bukkit.Bukkit;
8 | import org.bukkit.block.Block;
9 | import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
10 |
11 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
12 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
13 |
14 | public class NMSHandler implements INMSHandler
15 | {
16 | private HashMap colors = new HashMap();
17 | {
18 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
19 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
20 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
21 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
22 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
23 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
24 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
25 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
26 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
27 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
28 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
29 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
30 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
31 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
32 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
33 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
34 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
35 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
36 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
37 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
38 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
39 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
40 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
41 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
42 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
43 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
44 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
45 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
46 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
47 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
48 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
49 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
50 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
51 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
52 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
53 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
54 | }
55 |
56 | @Override
57 | public MaterialMapColorInterface getColorNeutral()
58 | {
59 | return colors.get(MaterialMapColor.b);
60 | }
61 |
62 | @SuppressWarnings("deprecation")
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | MaterialMapColor nms = CraftMagicNumbers.getBlock(block).f(block.getData());
67 |
68 | if (!colors.containsKey(nms))
69 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
70 |
71 | return colors.get(CraftMagicNumbers.getBlock(block).f(block.getData()));
72 | }
73 |
74 | @Override
75 | public boolean hasTwoHands() {
76 | return false;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/modules/compat-1.7.5/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.7.5/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.7.5
7 | serverminimap-v1.7-R2
8 | v1.7-R2
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.7.5-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.7.5/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R2/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R2;
2 |
3 | import net.minecraft.server.v1_7_R2.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.7.5/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R2/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R2;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_7_R2.MaterialMapColor;
6 |
7 | import org.bukkit.Bukkit;
8 | import org.bukkit.block.Block;
9 | import org.bukkit.craftbukkit.v1_7_R2.util.CraftMagicNumbers;
10 |
11 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
12 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
13 |
14 | public class NMSHandler implements INMSHandler
15 | {
16 | private HashMap colors = new HashMap();
17 | {
18 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
19 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
20 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
21 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
22 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
23 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
24 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
25 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
26 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
27 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
28 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
29 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
30 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
31 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
32 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
33 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
34 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
35 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
36 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
37 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
38 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
39 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
40 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
41 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
42 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
43 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
44 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
45 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
46 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
47 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
48 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
49 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
50 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
51 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
52 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
53 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
54 | }
55 |
56 | @Override
57 | public MaterialMapColorInterface getColorNeutral()
58 | {
59 | return colors.get(MaterialMapColor.b);
60 | }
61 |
62 | @SuppressWarnings("deprecation")
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | MaterialMapColor nms = CraftMagicNumbers.getBlock(block).f(block.getData());
67 |
68 | if (!colors.containsKey(nms))
69 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
70 |
71 | return colors.get(CraftMagicNumbers.getBlock(block).f(block.getData()));
72 | }
73 |
74 | @Override
75 | public boolean hasTwoHands() {
76 | return false;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/modules/compat-1.7.8/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.7.8/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.7.8
7 | serverminimap-v1.7-R3
8 | v1.7-R3
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.7.8-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.7.8/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R3/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R3;
2 |
3 | import net.minecraft.server.v1_7_R3.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.7.8/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R3/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R3;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_7_R3.MaterialMapColor;
6 |
7 | import org.bukkit.Bukkit;
8 | import org.bukkit.block.Block;
9 | import org.bukkit.craftbukkit.v1_7_R3.util.CraftMagicNumbers;
10 |
11 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
12 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
13 |
14 | public class NMSHandler implements INMSHandler
15 | {
16 | private HashMap colors = new HashMap();
17 | {
18 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
19 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
20 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
21 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
22 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
23 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
24 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
25 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
26 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
27 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
28 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
29 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
30 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
31 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
32 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
33 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
34 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
35 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
36 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
37 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
38 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
39 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
40 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
41 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
42 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
43 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
44 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
45 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
46 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
47 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
48 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
49 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
50 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
51 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
52 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
53 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
54 | }
55 |
56 | @Override
57 | public MaterialMapColorInterface getColorNeutral()
58 | {
59 | return colors.get(MaterialMapColor.b);
60 | }
61 |
62 | @SuppressWarnings("deprecation")
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | MaterialMapColor nms = CraftMagicNumbers.getBlock(block).f(block.getData());
67 |
68 | if (!colors.containsKey(nms))
69 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
70 |
71 | return colors.get(CraftMagicNumbers.getBlock(block).f(block.getData()));
72 | }
73 |
74 | @Override
75 | public boolean hasTwoHands() {
76 | return false;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/modules/compat-1.7/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.7/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.7
7 | serverminimap-v1.7-R1
8 | v1.7-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.7.2-R0.3
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.7/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R1;
2 |
3 | import net.minecraft.server.v1_7_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.7/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_7_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_7_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_7_R1.MaterialMapColor;
6 |
7 | import org.bukkit.Bukkit;
8 | import org.bukkit.block.Block;
9 | import org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers;
10 |
11 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
12 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
13 |
14 | public class NMSHandler implements INMSHandler
15 | {
16 | private HashMap colors = new HashMap();
17 | {
18 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
19 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
20 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
21 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
22 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
23 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
24 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
25 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
26 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
27 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
28 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
29 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
30 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
31 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
32 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
33 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
34 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
35 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
36 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
37 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
38 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
39 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
40 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
41 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
42 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
43 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
44 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
45 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
46 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
47 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
48 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
49 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
50 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
51 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
52 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
53 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
54 | }
55 |
56 | @Override
57 | public MaterialMapColorInterface getColorNeutral()
58 | {
59 | return colors.get(MaterialMapColor.b);
60 | }
61 |
62 | @SuppressWarnings("deprecation")
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | MaterialMapColor nms = CraftMagicNumbers.getBlock(block).f(block.getData());
67 |
68 | if (!colors.containsKey(nms))
69 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
70 |
71 | return colors.get(CraftMagicNumbers.getBlock(block).f(block.getData()));
72 | }
73 |
74 | @Override
75 | public boolean hasTwoHands() {
76 | return false;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/modules/compat-1.8.3/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.8.3/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.8.3
7 | serverminimap-v1.8-R2
8 | v1.8-R2
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.8.3-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.8.3/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_8_R2/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_8_R2;
2 |
3 | import net.minecraft.server.v1_8_R2.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.8.3/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_8_R2/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_8_R2;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_8_R2.MaterialMapColor;
6 | import net.minecraft.server.v1_8_R2.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_8_R2.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_8_R2.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_8_R2.CraftChunk w = (org.bukkit.craftbukkit.v1_8_R2.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.g(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return false;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/modules/compat-1.8.4/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.8.4/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.8.4
7 | serverminimap-v1.8-R3
8 | v1.8-R3
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.8.6-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.8.4/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_8_R3/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_8_R3;
2 |
3 | import net.minecraft.server.v1_8_R3.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.8.4/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_8_R3/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_8_R3;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_8_R3.MaterialMapColor;
6 | import net.minecraft.server.v1_8_R3.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_8_R3.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_8_R3.CraftChunk w = (org.bukkit.craftbukkit.v1_8_R3.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.g(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return false;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/modules/compat-1.8/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.8/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.8
7 | serverminimap-v1.8-R1
8 | v1.8-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.8-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.8/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_8_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_8_R1;
2 |
3 | import net.minecraft.server.v1_8_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.8/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_8_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_8_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_8_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_8_R1.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_8_R1.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_8_R1.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_8_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_8_R1.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.g(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return false;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/modules/compat-1.9.4/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.9.4/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.9.4
7 | serverminimap-v1.9-R2
8 | v1.9-R2
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.9.4-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.9.4/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_9_R2/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_9_R2;
2 |
3 | import net.minecraft.server.v1_9_R2.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.9.4/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_9_R2/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_9_R2;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_9_R2.MaterialMapColor;
6 | import net.minecraft.server.v1_9_R2.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_9_R2.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_9_R2.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_9_R2.CraftChunk w = (org.bukkit.craftbukkit.v1_9_R2.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.r(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return true;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/modules/compat-1.9/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 |
3 | /.project
4 |
5 | /.settings
6 | /target
--------------------------------------------------------------------------------
/modules/compat-1.9/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | compat-1.9
7 | serverminimap-v1.9-R1
8 | v1.9-R1
9 |
10 |
11 | serverminimap
12 | de.craftlancer
13 | parent
14 | ../../
15 |
16 |
17 |
18 |
19 | org.bukkit
20 | craftbukkit
21 | 1.9-R0.1-SNAPSHOT
22 |
23 |
24 | de.craftlancer
25 | serverminimap-nmshandler
26 | API
27 |
28 |
29 |
30 |
31 | UTF-8
32 |
33 |
34 |
--------------------------------------------------------------------------------
/modules/compat-1.9/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_9_R1/MaterialMapColorWrapper.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_9_R1;
2 |
3 | import net.minecraft.server.v1_9_R1.MaterialMapColor;
4 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
5 |
6 | public class MaterialMapColorWrapper implements MaterialMapColorInterface
7 | {
8 | private MaterialMapColor color;
9 |
10 | public MaterialMapColorWrapper(MaterialMapColor color)
11 | {
12 | this.color = color;
13 | }
14 |
15 | @Override
16 | public int getM()
17 | {
18 | return color.M;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/compat-1.9/src/main/java/de/craftlancer/serverminimap/nmscompat/v1_9_R1/NMSHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.nmscompat.v1_9_R1;
2 |
3 | import java.util.HashMap;
4 |
5 | import net.minecraft.server.v1_9_R1.MaterialMapColor;
6 | import net.minecraft.server.v1_9_R1.BlockPosition;
7 |
8 | import org.bukkit.Bukkit;
9 | import org.bukkit.block.Block;
10 | import org.bukkit.craftbukkit.v1_9_R1.util.CraftMagicNumbers;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
14 |
15 | public class NMSHandler implements INMSHandler
16 | {
17 | private HashMap colors = new HashMap();
18 | {
19 | colors.put(MaterialMapColor.b, new MaterialMapColorWrapper(MaterialMapColor.b));
20 | colors.put(MaterialMapColor.c, new MaterialMapColorWrapper(MaterialMapColor.c));
21 | colors.put(MaterialMapColor.d, new MaterialMapColorWrapper(MaterialMapColor.d));
22 | colors.put(MaterialMapColor.e, new MaterialMapColorWrapper(MaterialMapColor.e));
23 | colors.put(MaterialMapColor.f, new MaterialMapColorWrapper(MaterialMapColor.f));
24 | colors.put(MaterialMapColor.g, new MaterialMapColorWrapper(MaterialMapColor.g));
25 | colors.put(MaterialMapColor.h, new MaterialMapColorWrapper(MaterialMapColor.h));
26 | colors.put(MaterialMapColor.i, new MaterialMapColorWrapper(MaterialMapColor.i));
27 | colors.put(MaterialMapColor.j, new MaterialMapColorWrapper(MaterialMapColor.j));
28 | colors.put(MaterialMapColor.k, new MaterialMapColorWrapper(MaterialMapColor.k));
29 | colors.put(MaterialMapColor.l, new MaterialMapColorWrapper(MaterialMapColor.l));
30 | colors.put(MaterialMapColor.m, new MaterialMapColorWrapper(MaterialMapColor.m));
31 | colors.put(MaterialMapColor.n, new MaterialMapColorWrapper(MaterialMapColor.n));
32 | colors.put(MaterialMapColor.o, new MaterialMapColorWrapper(MaterialMapColor.o));
33 | colors.put(MaterialMapColor.p, new MaterialMapColorWrapper(MaterialMapColor.p));
34 | colors.put(MaterialMapColor.q, new MaterialMapColorWrapper(MaterialMapColor.q));
35 | colors.put(MaterialMapColor.r, new MaterialMapColorWrapper(MaterialMapColor.r));
36 | colors.put(MaterialMapColor.s, new MaterialMapColorWrapper(MaterialMapColor.s));
37 | colors.put(MaterialMapColor.t, new MaterialMapColorWrapper(MaterialMapColor.t));
38 | colors.put(MaterialMapColor.u, new MaterialMapColorWrapper(MaterialMapColor.u));
39 | colors.put(MaterialMapColor.v, new MaterialMapColorWrapper(MaterialMapColor.v));
40 | colors.put(MaterialMapColor.w, new MaterialMapColorWrapper(MaterialMapColor.w));
41 | colors.put(MaterialMapColor.x, new MaterialMapColorWrapper(MaterialMapColor.x));
42 | colors.put(MaterialMapColor.y, new MaterialMapColorWrapper(MaterialMapColor.y));
43 | colors.put(MaterialMapColor.z, new MaterialMapColorWrapper(MaterialMapColor.z));
44 | colors.put(MaterialMapColor.A, new MaterialMapColorWrapper(MaterialMapColor.A));
45 | colors.put(MaterialMapColor.B, new MaterialMapColorWrapper(MaterialMapColor.B));
46 | colors.put(MaterialMapColor.C, new MaterialMapColorWrapper(MaterialMapColor.C));
47 | colors.put(MaterialMapColor.D, new MaterialMapColorWrapper(MaterialMapColor.D));
48 | colors.put(MaterialMapColor.E, new MaterialMapColorWrapper(MaterialMapColor.E));
49 | colors.put(MaterialMapColor.F, new MaterialMapColorWrapper(MaterialMapColor.F));
50 | colors.put(MaterialMapColor.G, new MaterialMapColorWrapper(MaterialMapColor.G));
51 | colors.put(MaterialMapColor.H, new MaterialMapColorWrapper(MaterialMapColor.H));
52 | colors.put(MaterialMapColor.I, new MaterialMapColorWrapper(MaterialMapColor.I));
53 | colors.put(MaterialMapColor.J, new MaterialMapColorWrapper(MaterialMapColor.J));
54 | colors.put(MaterialMapColor.K, new MaterialMapColorWrapper(MaterialMapColor.K));
55 | }
56 |
57 | @Override
58 | public MaterialMapColorInterface getColorNeutral()
59 | {
60 | return colors.get(MaterialMapColor.b);
61 | }
62 |
63 | @Override
64 | public MaterialMapColorInterface getBlockColor(Block block)
65 | {
66 | net.minecraft.server.v1_9_R1.Block nmsblock = CraftMagicNumbers.getBlock(block);
67 | org.bukkit.craftbukkit.v1_9_R1.CraftChunk w = (org.bukkit.craftbukkit.v1_9_R1.CraftChunk) block.getChunk();
68 |
69 | MaterialMapColor nms = nmsblock.r(w.getHandle().getBlockData(new BlockPosition(block.getX(), block.getY(), block.getZ())));
70 |
71 | if (!colors.containsKey(nms))
72 | Bukkit.getLogger().severe("[ServerMinimap] unknown color, error in NMSHandler - please report to author!");
73 |
74 | return colors.get(nms);
75 | }
76 |
77 | @Override
78 | public boolean hasTwoHands() {
79 | return true;
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | de.craftlancer
6 | serverminimap
7 | parent
8 | ServerMinimap
9 | pom
10 |
11 |
12 | UTF-8
13 |
14 |
15 |
16 | modules/CompatHandler
17 | modules/compat-1.5
18 | modules/compat-1.6
19 | modules/compat-1.7
20 | modules/compat-1.7.5
21 | modules/compat-1.7.8
22 | modules/compat-1.7.10
23 | modules/compat-1.8
24 | modules/compat-1.8.3
25 | modules/compat-1.8.4
26 | modules/compat-1.9
27 | modules/compat-1.9.4
28 | modules/compat-1.10
29 | modules/compat-1.11
30 | modules/compat-1.12
31 | modules/compat-1.13
32 | modules/compat-1.13.1
33 | modules/compat-1.14
34 | modules/compat-1.15
35 | modules/compat-1.16.1
36 | modules/compat-1.16.2
37 | modules/compat-1.16.4
38 | modules/compat-1.17
39 | modules/compat-1.18
40 | modules/ServerMinimap
41 |
42 |
43 |
44 |
45 | spigot-repo
46 | http://hub.spigotmc.org/nexus/content/groups/public/
47 |
48 |
49 |
50 |
51 |
52 | org.bukkit
53 | bukkit
54 | 1.14-R0.1-SNAPSHOT
55 |
56 |
57 |
58 | org.bukkit
59 | craftbukkit
60 | 1.14-R0.1-SNAPSHOT
61 |
62 |
63 |
64 |
65 |
66 |
67 | org.apache.maven.plugins
68 | maven-compiler-plugin
69 | 3.8.1
70 |
71 | 16
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/Coords.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | public class Coords
4 | {
5 | private int x;
6 | private int z;
7 | private boolean chunk;
8 | private String world;
9 |
10 | public Coords(int x, int z, boolean chunk, String world)
11 | {
12 | this.x = x;
13 | this.z = z;
14 | this.chunk = chunk;
15 | this.world = world;
16 | }
17 |
18 | public boolean isChunk()
19 | {
20 | return chunk;
21 | }
22 |
23 | public int getX()
24 | {
25 | return x;
26 | }
27 |
28 | public int getZ()
29 | {
30 | return z;
31 | }
32 |
33 | public String getWorld()
34 | {
35 | return world;
36 | }
37 |
38 | @Override
39 | public int hashCode()
40 | {
41 | final int prime = 31;
42 | int result = 1;
43 | result = prime * result + (chunk ? 1231 : 1237);
44 | result = prime * result + ((world == null) ? 0 : world.hashCode());
45 | result = prime * result + x;
46 | result = prime * result + z;
47 | return result;
48 | }
49 |
50 | @Override
51 | public boolean equals(Object obj)
52 | {
53 | if (this == obj)
54 | return true;
55 | if (obj == null)
56 | return false;
57 | if (!(obj instanceof Coords))
58 | return false;
59 | Coords other = (Coords) obj;
60 | if (chunk != other.chunk)
61 | return false;
62 | if (world == null)
63 | {
64 | if (other.world != null)
65 | return false;
66 | }
67 | else if (!world.equals(other.world))
68 | return false;
69 | if (x != other.x)
70 | return false;
71 | if (z != other.z)
72 | return false;
73 | return true;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/ExtraCursor.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import org.bukkit.map.MapCursor;
4 |
5 | /**
6 | * Represents a cursor, that will be shown when it is in the players minimap
7 | * range.
8 | */
9 | public class ExtraCursor
10 | {
11 | private int x;
12 | private int z;
13 | private boolean visible;
14 | private MapCursor.Type type;
15 | private byte direction;
16 | private String world;
17 | private boolean outside;
18 |
19 | /**
20 | * Construct a new ExtraCursor object.
21 | *
22 | * @param x - the absolute x coordinates of the cursor
23 | * @param z - the absolute z coordinates of the cursor
24 | * @param visible - whether the cursor is visible or not
25 | * @param type - the type/shape of the cursor
26 | * @param direction - the direction the cursor is pointing at
27 | * @param world - the world of the cursor
28 | * @param outside - whether the cursor is shown at the edge of the map, if it isn't within the bounds of the map
29 | */
30 | public ExtraCursor(int x, int z, boolean visible, MapCursor.Type type, byte direction, String world, boolean outside)
31 | {
32 | setX(x);
33 | setZ(z);
34 | setVisible(visible);
35 | setType(type);
36 | setDirection(direction);
37 | setWorld(world);
38 | setShowOutside(outside);
39 | }
40 |
41 | /**
42 | * Get the x coordinate of the marker.
43 | *
44 | * @return the x coordinate using the MC coordinate system.
45 | */
46 | public int getX()
47 | {
48 | return x;
49 | }
50 |
51 | /**
52 | * Set the x coordinate of the marker.
53 | *
54 | * @param x the x coordinate in the MC coordinate system.
55 | */
56 | public void setX(int x)
57 | {
58 | this.x = x;
59 | }
60 |
61 | /**
62 | * Get the z coordinate of the marker.
63 | *
64 | * @return the z coordinate using the MC coordinate system.
65 | */
66 | public int getZ()
67 | {
68 | return z;
69 | }
70 |
71 | /**
72 | * Set the z coordinate of the marker.
73 | *
74 | * @param z the z coordinate in the MC coordinate system.
75 | */
76 | public void setZ(int z)
77 | {
78 | this.z = z;
79 | }
80 |
81 | /**
82 | * Get if the marker is visible.
83 | *
84 | * @return true if the marker is visible, false if not
85 | */
86 | public boolean isVisible()
87 | {
88 | return visible;
89 | }
90 |
91 | /**
92 | * Set the visibility of the marker.
93 | *
94 | * @param visible true for a visible marker, false for invisible
95 | */
96 | public void setVisible(boolean visible)
97 | {
98 | this.visible = visible;
99 | }
100 |
101 | /**
102 | * Get the shape of the cursor.
103 | * See MapCursor.Type for available types.
104 | *
105 | * @return the shape type of the cursor
106 | */
107 | public MapCursor.Type getType()
108 | {
109 | return type;
110 | }
111 |
112 | /**
113 | * Set the shape of the cursor.
114 | * See MapCursor.Type for available types.
115 | *
116 | * @param type the type of the cursor
117 | */
118 | public void setType(MapCursor.Type type)
119 | {
120 | this.type = type;
121 | }
122 |
123 | /**
124 | * Get the direction the cursor is looking.
125 | * There are 16 possible directions where between them lays a difference of
126 | * 22,5 degree.
127 | *
128 | * @return the byte value of the direction, between 0 and 15
129 | */
130 | public byte getDirection()
131 | {
132 | return direction;
133 | }
134 |
135 | /**
136 | * Set the direction in which the cursor is looking.
137 | * Values values are between 0 and 15. 0 is pointing north, between 2 values
138 | * are 22,5 degree rotation.
139 | *
140 | * @param direction
141 | * s byte value. It makes sure that the direction value is always
142 | * between 0 and 15 by calculating the input with mod 16.
143 | */
144 | public void setDirection(byte direction)
145 | {
146 | this.direction = (byte) (direction % 16);
147 | }
148 |
149 | /**
150 | * Get the world the cursor is shown in.
151 | *
152 | * @return the name of the world (World#getName())
153 | */
154 | public String getWorld()
155 | {
156 | return world;
157 | }
158 |
159 | /**
160 | * Set the world the cursor is shown in.
161 | *
162 | * @param world the name of the world (World#getName())
163 | */
164 | public void setWorld(String world)
165 | {
166 | this.world = world;
167 | }
168 |
169 | @Override
170 | public String toString()
171 | {
172 | return x + " " + z + " " + world + " " + visible;
173 | }
174 |
175 | public boolean isShownOutside()
176 | {
177 | return outside;
178 | }
179 |
180 | public void setShowOutside(boolean bool)
181 | {
182 | outside = bool;
183 | }
184 | }
185 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/MapChunk.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
4 |
5 | public class MapChunk
6 | {
7 | private MaterialMapColorInterface cache[][] = new MaterialMapColorInterface[16][16];
8 | private short avgY[][] = new short[16][16];
9 |
10 | public MapChunk(ServerMinimap plugin)
11 | {
12 | for (int i = 0; i < 16; i++)
13 | for (int j = 0; j < 16; j++)
14 | {
15 | cache[i][j] = plugin.getNMSHandler().getColorNeutral();
16 | avgY[i][j] = 64;
17 | }
18 | }
19 |
20 | public void set(int i, int j, RenderResult value)
21 | {
22 | cache[i][j] = value.getColor();
23 | avgY[i][j] = value.getAverageY();
24 | }
25 |
26 | public MaterialMapColorInterface get(int i, int j)
27 | {
28 | return cache[i][j];
29 | }
30 |
31 | public short getY(int i, int j)
32 | {
33 | return avgY[i][j];
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/MinimapCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import org.bukkit.Material;
4 | import org.bukkit.command.Command;
5 | import org.bukkit.command.CommandExecutor;
6 | import org.bukkit.command.CommandSender;
7 | import org.bukkit.entity.Player;
8 | import org.bukkit.inventory.ItemStack;
9 | import org.bukkit.inventory.meta.MapMeta;
10 |
11 | public class MinimapCommand implements CommandExecutor {
12 |
13 | @Override
14 | public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
15 | if (!(sender instanceof Player) || !sender.hasPermission("minimap.command.minimap")) {
16 | sender.sendMessage("You are not able to run this command!");
17 | return true;
18 | }
19 |
20 | ItemStack is = new ItemStack(Material.FILLED_MAP);
21 | MapMeta meta = (MapMeta) is.getItemMeta();
22 | meta.setMapId(ServerMinimap.MAPID);
23 | is.setItemMeta(meta);
24 |
25 | if (!((Player) sender).getInventory().addItem(is).isEmpty())
26 | sender.sendMessage("Could not give you the map. Maybe your inventory is full?");
27 | else
28 | sender.sendMessage("There is your Map.");
29 |
30 | return true;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/OneHandedRenderer.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import org.bukkit.Material;
4 | import org.bukkit.entity.Player;
5 | import org.bukkit.map.MapCanvas;
6 | import org.bukkit.map.MapView;
7 |
8 | public class OneHandedRenderer extends MinimapRenderer {
9 |
10 | public OneHandedRenderer(int scale, int cpr, ServerMinimap plugin) {
11 | super(scale, cpr, plugin);
12 | }
13 |
14 | @Override
15 | public void render(MapView map, MapCanvas canvas, Player player) {
16 | if (!(player.getItemInHand().getType() == Material.MAP && player.getItemInHand().getDurability() == ServerMinimap.MAPID))
17 | return;
18 |
19 | super.render(map, canvas, player);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/RenderResult.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import de.craftlancer.serverminimap.nmscompat.MaterialMapColorInterface;
4 |
5 | public class RenderResult
6 | {
7 | private MaterialMapColorInterface color;
8 | private short avgY;
9 |
10 | public RenderResult(MaterialMapColorInterface color, short avgY)
11 | {
12 | this.color = color;
13 | this.avgY = avgY;
14 | }
15 |
16 | public MaterialMapColorInterface getColor()
17 | {
18 | return color;
19 | }
20 |
21 | public short getAverageY()
22 | {
23 | return avgY;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/RenderTask.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import org.bukkit.scheduler.BukkitRunnable;
4 |
5 | public class RenderTask extends BukkitRunnable
6 | {
7 | private MinimapRenderer renderer;
8 |
9 | public RenderTask(MinimapRenderer renderer)
10 | {
11 | this.renderer = renderer;
12 | }
13 |
14 | @Override
15 | public void run()
16 | {
17 | int chunks = 0;
18 | int blocks = 0;
19 |
20 | while (chunks < renderer.getChunksPerRun())
21 | {
22 | Coords c = renderer.getQueue().poll();
23 |
24 | if (c == null)
25 | break;
26 |
27 | if (c.isChunk())
28 | {
29 | renderer.loadData(c.getX(), c.getZ(), c.getWorld());
30 | chunks++;
31 | }
32 | else
33 | {
34 | renderer.loadBlock(c.getX(), c.getZ(), c.getWorld());
35 | blocks++;
36 | if (blocks >= 16 * 16 * renderer.getDefaultScale() * renderer.getDefaultScale())
37 | {
38 | blocks = 0;
39 | chunks++;
40 | }
41 | }
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/SendTask.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import org.bukkit.Bukkit;
4 | import org.bukkit.Material;
5 | import org.bukkit.entity.Player;
6 | import org.bukkit.map.MapView;
7 | import org.bukkit.scheduler.BukkitRunnable;
8 |
9 | public class SendTask extends BukkitRunnable
10 | {
11 | @SuppressWarnings("deprecation")
12 | @Override
13 | public void run()
14 | {
15 | for (Player p : Bukkit.getOnlinePlayers())
16 | if (p.hasPermission("minimap.fastupdate"))
17 | if (p.getItemInHand().getType() == Material.MAP && p.getItemInHand().getDurability() == ServerMinimap.MAPID)
18 | {
19 | MapView map = Bukkit.getMap(ServerMinimap.MAPID);
20 | if (map != null)
21 | p.sendMap(map);
22 | }
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/ServerMinimap.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import java.io.File;
4 |
5 | import org.bukkit.World;
6 | import org.bukkit.configuration.file.FileConfiguration;
7 | import org.bukkit.map.MapRenderer;
8 | import org.bukkit.map.MapView;
9 | import org.bukkit.metadata.FixedMetadataValue;
10 | import org.bukkit.plugin.java.JavaPlugin;
11 |
12 | import de.craftlancer.serverminimap.nmscompat.INMSHandler;
13 | import de.craftlancer.serverminimap.waypoint.WaypointCommandHandler;
14 | import de.craftlancer.serverminimap.waypoint.WaypointHandler;
15 |
16 | /**
17 | * The plugin is based on a request/idea by toxictroop and by the team at:
18 | * http://www.crossfiregaming.net/
19 | * http://forums.bukkit.org/threads/dynamic-maps.146024/
20 | *
21 | * @author Syd
22 | */
23 | public class ServerMinimap extends JavaPlugin
24 | {
25 | public static int MAPID = 0;
26 | private FileConfiguration config;
27 | private int SCALE = 0;
28 | private int CPR = 8;
29 | private int runPerTicks = 1;
30 | private int fastTicks = 20;
31 | private boolean canSeeOthers;
32 | private boolean distantWaypoints;
33 |
34 | private WaypointHandler waypoint;
35 |
36 | private INMSHandler nms;
37 |
38 | @Override
39 | public void onEnable()
40 | {
41 | setupNMSHandler();
42 |
43 | loadConfig();
44 | loadMap();
45 |
46 | waypoint = new WaypointHandler(this);
47 | waypoint.load();
48 | getServer().getPluginManager().registerEvents(waypoint, this);
49 |
50 | getCommand("waypoint").setExecutor(new WaypointCommandHandler(this));
51 | getCommand("minimap").setExecutor(new MinimapCommand());
52 | }
53 |
54 | private void setupNMSHandler()
55 | {
56 | String cbPackage = getServer().getClass().getPackage().getName();
57 | String version = cbPackage.substring(cbPackage.lastIndexOf('.') + 1);
58 |
59 | try
60 | {
61 | Class> c = Class.forName("de.craftlancer.serverminimap.nmscompat." + version + ".NMSHandler");
62 | if (INMSHandler.class.isAssignableFrom(c))
63 | nms = (INMSHandler) c.getConstructor().newInstance();
64 | }
65 | catch (Exception e)
66 | {
67 | e.printStackTrace();
68 | getLogger().severe("Error while loading NMS Compat Layer - please notify author!");
69 | }
70 | }
71 |
72 | public INMSHandler getNMSHandler()
73 | {
74 | return nms;
75 | }
76 |
77 | @Override
78 | public void onDisable()
79 | {
80 | waypoint.save();
81 | config.set("mapID", MAPID);
82 | saveConfig();
83 | getServer().getScheduler().cancelTasks(this);
84 | }
85 |
86 | private void loadConfig()
87 | {
88 | if (!new File(getDataFolder().getPath() + File.separatorChar + "config.yml").exists())
89 | saveDefaultConfig();
90 |
91 | config = getConfig();
92 |
93 | SCALE = config.getInt("scale", 0);
94 | CPR = config.getInt("chunksPerRun", 4);
95 | runPerTicks = config.getInt("runPerTicks", 1);
96 | fastTicks = config.getInt("fastTicks", 20);
97 | canSeeOthers = config.getBoolean("canSeeOthers", true);
98 | MAPID = (short) config.getInt("mapID", 0);
99 | distantWaypoints = config.getBoolean("showDistantWaypoints", false);
100 |
101 | for (String s : config.getConfigurationSection("worlds").getKeys(false))
102 | {
103 | World w = getServer().getWorld(s);
104 |
105 | if (w == null)
106 | continue;
107 |
108 | if (!config.getBoolean("worlds." + s + ".enabled", true))
109 | w.setMetadata("minimap.disabled", new FixedMetadataValue(this, null));
110 |
111 | if (config.isInt("worlds." + s + ".drawHeight"))
112 | w.setMetadata("minimap.drawheight", new FixedMetadataValue(this, config.getInt("worlds." + s + ".drawHeight")));
113 |
114 | if (config.isInt("worlds." + s + ".scale"))
115 | {
116 | int value = config.getInt("worlds." + s + ".scale");
117 | if (value < 1)
118 | value = 1;
119 | w.setMetadata("minimap.scale", new FixedMetadataValue(this, value));
120 | }
121 | }
122 | }
123 |
124 | public int getRunPerTicks()
125 | {
126 | return runPerTicks;
127 | }
128 |
129 | public int getFastTicks()
130 | {
131 | return fastTicks;
132 | }
133 |
134 | public boolean canSeeOthers()
135 | {
136 | return canSeeOthers;
137 | }
138 |
139 | public int getScale()
140 | {
141 | return SCALE;
142 | }
143 |
144 | @SuppressWarnings("deprecation")
145 | private void loadMap()
146 | {
147 | MapView map = getServer().getMap(MAPID);
148 | if (map == null)
149 | map = getServer().createMap(getServer().getWorlds().get(0));
150 |
151 | MAPID = map.getId();
152 |
153 | if (!(map.getRenderers().get(0) instanceof MinimapRenderer))
154 | {
155 | for (MapRenderer r : map.getRenderers())
156 | map.removeRenderer(r);
157 |
158 | MinimapRenderer renderer = getNMSHandler().hasTwoHands() ? new TwoHandedRenderer(SCALE, CPR, this) : new OneHandedRenderer(SCALE, CPR, this);
159 |
160 | map.addRenderer(renderer);
161 | }
162 |
163 | getLogger().info("Created Minimap with ID " + MAPID + ". Use /give MAP 1 " + MAPID + " to get the map as item. (Vanilla command)");
164 | getLogger().info("Alternative command: /minimap (Plugin command)");
165 | }
166 |
167 | public WaypointHandler getWaypointHandler()
168 | {
169 | return waypoint;
170 | }
171 |
172 | public boolean showDistantWaypoints()
173 | {
174 | return distantWaypoints;
175 | }
176 |
177 | }
178 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/TwoHandedRenderer.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap;
2 |
3 | import org.bukkit.Material;
4 | import org.bukkit.entity.Player;
5 | import org.bukkit.inventory.ItemStack;
6 | import org.bukkit.inventory.meta.MapMeta;
7 | import org.bukkit.map.MapCanvas;
8 | import org.bukkit.map.MapView;
9 |
10 | public class TwoHandedRenderer extends MinimapRenderer {
11 |
12 | public TwoHandedRenderer(int scale, int cpr, ServerMinimap plugin) {
13 | super(scale, cpr, plugin);
14 | }
15 |
16 | @Override
17 | public void render(MapView map, MapCanvas canvas, Player player) {
18 | ItemStack main = player.getInventory().getItemInMainHand();
19 | ItemStack off = player.getInventory().getItemInOffHand();
20 |
21 | if(!(isMinimap(main) || isMinimap(off)))
22 | return;
23 |
24 | super.render(map, canvas, player);
25 | }
26 |
27 | private boolean isMinimap(ItemStack stack) {
28 | if(stack.getType() != Material.FILLED_MAP)
29 | return false;
30 |
31 | return ((MapMeta) stack.getItemMeta()).getMapId() == ServerMinimap.MAPID;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/data/ConfigHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.data;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.util.ArrayList;
6 | import java.util.HashMap;
7 | import java.util.List;
8 | import java.util.Map;
9 | import java.util.Map.Entry;
10 | import java.util.UUID;
11 |
12 | import org.bukkit.Bukkit;
13 | import org.bukkit.configuration.file.FileConfiguration;
14 | import org.bukkit.configuration.file.YamlConfiguration;
15 | import org.bukkit.map.MapCursor;
16 |
17 | import de.craftlancer.serverminimap.ExtraCursor;
18 | import de.craftlancer.serverminimap.ServerMinimap;
19 | import de.craftlancer.serverminimap.waypoint.Waypoint;
20 |
21 | /*
22 | * TODO update to more extensible system that allows easier updates and new features
23 | */
24 | public class ConfigHandler implements DataHandler
25 | {
26 | private File file;
27 | private FileConfiguration config;
28 | private ServerMinimap plugin;
29 |
30 | public ConfigHandler(ServerMinimap plugin)
31 | {
32 | this.plugin = plugin;
33 | file = new File(plugin.getDataFolder(), "waypoints.yml");
34 | config = YamlConfiguration.loadConfiguration(file);
35 | }
36 |
37 | @SuppressWarnings("deprecation")
38 | @Override
39 | public Map> loadWaypoints()
40 | {
41 | Map> map = new HashMap>();
42 |
43 | boolean requiresUpdaterSave = false;
44 |
45 | for (String key : config.getKeys(false))
46 | {
47 | UUID uuid;
48 | boolean updated = false;
49 |
50 | try
51 | {
52 | uuid = UUID.fromString(key);
53 | }
54 | catch (IllegalArgumentException e)
55 | {
56 | uuid = Bukkit.getOfflinePlayer(key).getUniqueId();
57 | if (uuid != null)
58 | {
59 | requiresUpdaterSave = true;
60 | updated = true;
61 | }
62 | else
63 | {
64 | plugin.getLogger().warning("Could not resolve UUID for " + key + "! The waypoint data of this key might be lost!");
65 | continue;
66 | }
67 | }
68 |
69 | if (!map.containsKey(uuid))
70 | map.put(uuid, new ArrayList());
71 |
72 | for (String value : config.getStringList(key))
73 | {
74 | String[] arr = value.split(" ");
75 |
76 | if (arr.length < 3)
77 | continue;
78 |
79 | int x;
80 | int z;
81 |
82 | boolean visible = arr.length >= 4 ? !arr[3].equalsIgnoreCase("false") : true;
83 | String name = arr.length >= 5 ? arr[4] : "";
84 |
85 | try
86 | {
87 | x = Integer.parseInt(arr[0]);
88 | z = Integer.parseInt(arr[1]);
89 | }
90 | catch (NumberFormatException e)
91 | {
92 | plugin.getLogger().severe(arr[0] + " and/or " + arr[1] + " is not a number!");
93 | continue;
94 | }
95 |
96 | map.get(uuid).add(new Waypoint(x, z, visible, MapCursor.Type.WHITE_CROSS, (byte) 0, arr[2], plugin.showDistantWaypoints(), name));
97 | }
98 |
99 | if (updated)
100 | config.set(key, null);
101 | }
102 |
103 | if (requiresUpdaterSave)
104 | saveWaypoints(map);
105 |
106 | return map;
107 | }
108 |
109 | @Override
110 | public void saveWaypoints(Map> waypoints)
111 | {
112 | for (Entry> e : waypoints.entrySet())
113 | {
114 | List str = new ArrayList((int) (waypoints.size() * 1.25));
115 | for (ExtraCursor c : e.getValue())
116 | str.add(c.toString());
117 |
118 | config.set(e.getKey().toString(), str);
119 | }
120 |
121 | try
122 | {
123 | config.save(file);
124 | }
125 | catch (IOException e)
126 | {
127 | plugin.getLogger().severe("Failed to save waypoints.yml!");
128 | e.printStackTrace();
129 | }
130 | }
131 |
132 | @Override
133 | public void removeWaypoint(UUID player, Waypoint c)
134 | {
135 | }
136 |
137 | @Override
138 | public void updateVisible(UUID player, Waypoint c, boolean visible)
139 | {
140 | }
141 |
142 | @Override
143 | public void addWaypoint(UUID player, int x, int z, String world, boolean visible, String name)
144 | {
145 | }
146 |
147 | @Override
148 | public void updateName(UUID player, Waypoint c)
149 | {
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/data/DataHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.data;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 | import java.util.UUID;
6 |
7 | import de.craftlancer.serverminimap.waypoint.Waypoint;
8 |
9 | public interface DataHandler
10 | {
11 | public Map> loadWaypoints();
12 |
13 | public void saveWaypoints(Map> waypoints);
14 |
15 | public void addWaypoint(UUID player, int x, int z, String world, boolean visible, String name);
16 |
17 | public void removeWaypoint(UUID player, Waypoint c);
18 |
19 | public void updateVisible(UUID player, Waypoint c, boolean visible);
20 |
21 | public void updateName(UUID player, Waypoint c);
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/data/MySQL.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.data;
2 |
3 | import java.sql.Connection;
4 | import java.sql.DriverManager;
5 | import java.sql.PreparedStatement;
6 | import java.sql.ResultSet;
7 | import java.sql.SQLException;
8 | import java.util.ArrayList;
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 | import java.util.UUID;
13 |
14 | import org.bukkit.Bukkit;
15 | import org.bukkit.map.MapCursor.Type;
16 | import org.bukkit.scheduler.BukkitRunnable;
17 |
18 | import de.craftlancer.serverminimap.ServerMinimap;
19 | import de.craftlancer.serverminimap.waypoint.Waypoint;
20 |
21 | /*
22 | * TODO seriously rework the implementation, don't cache data on startup but request them when needed
23 | * in order to allow 3rd party editing of the database (consistency)
24 | * TODO add y coords to waypoints to allow more extended usage. (E.g. use a HoloPlugin to display waypoints)
25 | * Both is planned AFTER 0.8.0 release, as it requires a mayor rework of parts of the plugin.
26 | */
27 | public class MySQL implements DataHandler
28 | {
29 | private ServerMinimap plugin;
30 |
31 | private String host;
32 | private int port;
33 | private String user;
34 | private String pass;
35 | private String database;
36 | private String prefix;
37 |
38 | private Connection conn;
39 |
40 | private PreparedStatement getstatement;
41 | PreparedStatement insertstatement;
42 | PreparedStatement removestatement;
43 | PreparedStatement updatestatement;
44 | PreparedStatement updatestatementName;
45 |
46 | public MySQL(ServerMinimap plugin, String host, int port, String user, String pass, String database, String prefix)
47 | {
48 | this.plugin = plugin;
49 | this.host = host;
50 | this.port = port;
51 | this.user = user;
52 | this.pass = pass;
53 | this.database = database;
54 | this.prefix = prefix;
55 |
56 | String table = this.prefix + "waypoints";
57 |
58 | openConnection();
59 | try
60 | {
61 | getstatement = getConnection().prepareStatement("SELECT * FROM " + table);
62 | insertstatement = getConnection().prepareStatement("INSERT INTO " + table + " (player, x, z, world, visible, name) VALUES (?,?,?,?,?,?)");
63 | removestatement = getConnection().prepareStatement("DELETE FROM " + table + " WHERE player = ? AND x = ? AND z = ? AND world = ?");
64 | updatestatement = getConnection().prepareStatement("UPDATE " + table + " SET visible = ? WHERE player = ? AND x = ? AND z = ? AND world = ?");
65 | updatestatementName = getConnection().prepareStatement("UPDATE " + table + " SET name = ? WHERE player = ? AND x = ? AND z = ? AND world = ?");
66 | // -> no table available (general init - pre 0.7.2 version have player varchar(255)
67 | if (!conn.getMetaData().getTables(null, null, table, null).next())
68 | {
69 | PreparedStatement st = getConnection().prepareStatement("CREATE TABLE " + table + " ( player varchar(36), x int, z int, world varchar(255), visible boolean, name varchar(255) )");
70 | st.execute();
71 | st.close();
72 | }
73 | // -> name table not available (update from 0.7.5 and lower)
74 | else if (!conn.getMetaData().getColumns(null, null, table, "name").next())
75 | {
76 | PreparedStatement st = getConnection().prepareStatement("ALTER TABLE " + table + " ADD name varchar(255)");
77 | st.execute();
78 | st.close();
79 | }
80 | }
81 | catch (SQLException e)
82 | {
83 | e.printStackTrace();
84 | }
85 | }
86 |
87 | private void openConnection()
88 | {
89 | try
90 | {
91 | Class.forName("com.mysql.jdbc.Driver").newInstance();
92 | conn = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, user, pass);
93 | }
94 | catch (Exception e)
95 | {
96 | e.printStackTrace();
97 | }
98 | }
99 |
100 | private boolean checkConnection()
101 | {
102 | try
103 | {
104 | return !conn.isValid(1);
105 | }
106 | catch (SQLException e)
107 | {
108 | e.printStackTrace();
109 | return false;
110 | }
111 | }
112 |
113 | private Connection getConnection()
114 | {
115 | if (checkConnection())
116 | openConnection();
117 |
118 | return conn;
119 | }
120 |
121 | @SuppressWarnings("deprecation")
122 | @Override
123 | public Map> loadWaypoints()
124 | {
125 | try
126 | {
127 | Map> waypoints = new HashMap>();
128 | ResultSet rs = getstatement.executeQuery();
129 |
130 | while (rs.next())
131 | {
132 | boolean deleteOld = false;
133 | String player = rs.getString("player");
134 |
135 | UUID uuid = null;
136 | try
137 | {
138 | uuid = UUID.fromString(player);
139 | }
140 | catch (IllegalArgumentException e)
141 | {
142 | uuid = Bukkit.getOfflinePlayer(player).getUniqueId();
143 |
144 | if (uuid != null)
145 | deleteOld = true;
146 | else
147 | {
148 | plugin.getLogger().warning("Could not resolve UUID for " + player + "! The waypoint data of this key might be lost!");
149 | continue;
150 | }
151 | }
152 |
153 | int x = rs.getInt("x");
154 | int z = rs.getInt("z");
155 | String world = rs.getString("world");
156 | boolean visible = rs.getBoolean("visible");
157 | String name = rs.getString("name");
158 |
159 | if (!waypoints.containsKey(uuid))
160 | waypoints.put(uuid, new ArrayList());
161 |
162 | waypoints.get(uuid).add(new Waypoint(x, z, visible, Type.WHITE_CROSS, (byte) 0, world, plugin.showDistantWaypoints(), name));
163 |
164 | if (deleteOld)
165 | {
166 | removeOldWaypoint(player, x, z, world);
167 | addWaypoint(uuid, x, z, world, visible, name);
168 | }
169 | }
170 |
171 | rs.close();
172 | return waypoints;
173 | }
174 | catch (SQLException e)
175 | {
176 | e.printStackTrace();
177 | }
178 | finally
179 | {
180 | try
181 | {
182 | getstatement.close();
183 | }
184 | catch (SQLException e)
185 | {
186 | e.printStackTrace();
187 | }
188 | }
189 | return new HashMap>();
190 | }
191 |
192 | @Override
193 | public void saveWaypoints(Map> waypoints)
194 | {
195 | try
196 | {
197 | conn.close();
198 | }
199 | catch (SQLException e)
200 | {
201 | e.printStackTrace();
202 | }
203 | }
204 |
205 | @Override
206 | public void addWaypoint(final UUID player, final int x, final int z, final String world, final boolean visible, final String name)
207 | {
208 | new BukkitRunnable()
209 | {
210 | @Override
211 | public void run()
212 | {
213 | try
214 | {
215 | insertstatement.setString(1, player.toString());
216 | insertstatement.setInt(2, x);
217 | insertstatement.setInt(3, z);
218 | insertstatement.setString(4, world);
219 | insertstatement.setBoolean(5, visible);
220 | insertstatement.setString(6, name);
221 | insertstatement.execute();
222 | }
223 | catch (SQLException e)
224 | {
225 | e.printStackTrace();
226 | }
227 | }
228 | }.runTaskAsynchronously(plugin);
229 | }
230 |
231 | @Override
232 | public void removeWaypoint(final UUID player, final Waypoint c)
233 | {
234 | new BukkitRunnable()
235 | {
236 | @Override
237 | public void run()
238 | {
239 | try
240 | {
241 | removestatement.setString(1, player.toString());
242 | removestatement.setInt(2, c.getX());
243 | removestatement.setInt(3, c.getZ());
244 | removestatement.setString(4, c.getWorld());
245 | removestatement.execute();
246 | }
247 | catch (SQLException e)
248 | {
249 | e.printStackTrace();
250 | }
251 | }
252 | }.runTaskAsynchronously(plugin);
253 | }
254 |
255 | private void removeOldWaypoint(final String player, final int x, final int z, final String world)
256 | {
257 | new BukkitRunnable()
258 | {
259 | @Override
260 | public void run()
261 | {
262 | try
263 | {
264 | removestatement.setString(1, player);
265 | removestatement.setInt(2, x);
266 | removestatement.setInt(3, z);
267 | removestatement.setString(4, world);
268 | removestatement.execute();
269 | }
270 | catch (SQLException e)
271 | {
272 | e.printStackTrace();
273 | }
274 | }
275 | }.runTaskAsynchronously(plugin);
276 | }
277 |
278 | @Override
279 | public void updateVisible(final UUID player, final Waypoint c, final boolean visible)
280 | {
281 |
282 | new BukkitRunnable()
283 | {
284 | @Override
285 | public void run()
286 | {
287 | try
288 | {
289 | updatestatement.setBoolean(1, visible);
290 | updatestatement.setString(2, player.toString());
291 | updatestatement.setInt(3, c.getX());
292 | updatestatement.setInt(4, c.getZ());
293 | updatestatement.setString(5, c.getWorld());
294 | updatestatement.execute();
295 | }
296 | catch (SQLException e)
297 | {
298 | e.printStackTrace();
299 | }
300 | }
301 | }.runTaskAsynchronously(plugin);
302 | }
303 |
304 | @Override
305 | public void updateName(final UUID player, final Waypoint c)
306 | {
307 |
308 | new BukkitRunnable()
309 | {
310 | @Override
311 | public void run()
312 | {
313 | try
314 | {
315 | updatestatement.setString(1, c.getName());
316 | updatestatement.setString(2, player.toString());
317 | updatestatement.setInt(3, c.getX());
318 | updatestatement.setInt(4, c.getZ());
319 | updatestatement.setString(5, c.getWorld());
320 | updatestatement.execute();
321 | }
322 | catch (SQLException e)
323 | {
324 | e.printStackTrace();
325 | }
326 | }
327 | }.runTaskAsynchronously(plugin);
328 | }
329 | }
330 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/event/MinimapExtraCursorEvent.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.event;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.bukkit.entity.Player;
7 | import org.bukkit.event.Event;
8 | import org.bukkit.event.HandlerList;
9 |
10 | import de.craftlancer.serverminimap.ExtraCursor;
11 |
12 | /**
13 | * This event allows the add own markers to the minimap and is called every
14 | * tick.
15 | */
16 | public class MinimapExtraCursorEvent extends Event
17 | {
18 | private static final HandlerList handlers = new HandlerList();
19 | private final Player player;
20 | private List cursor = new ArrayList();
21 |
22 | public MinimapExtraCursorEvent(Player player)
23 | {
24 | this.player = player;
25 | }
26 |
27 | /**
28 | * Get all already added cursors.
29 | *
30 | * @return A mutable list of all added cursors.
31 | */
32 | public List getCursors()
33 | {
34 | return cursor;
35 | }
36 |
37 | /**
38 | * Get the player for whom this event is called.
39 | *
40 | * @return the Player
41 | */
42 | public Player getPlayer()
43 | {
44 | return player;
45 | }
46 |
47 | @Override
48 | public HandlerList getHandlers()
49 | {
50 | return handlers;
51 | }
52 |
53 | public static HandlerList getHandlerList()
54 | {
55 | return handlers;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/event/MinimapPlayerCursorEvent.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.event;
2 |
3 | import org.bukkit.entity.Player;
4 | import org.bukkit.event.Event;
5 | import org.bukkit.event.HandlerList;
6 | import org.bukkit.map.MapCursor.Type;
7 |
8 | public class MinimapPlayerCursorEvent extends Event
9 | {
10 | private static final HandlerList handlers = new HandlerList();
11 |
12 | private Player viewer;
13 | private Player viewed;
14 | private Type type;
15 | private boolean display;
16 |
17 | public MinimapPlayerCursorEvent(Player viewer, Player viewed, boolean canSee)
18 | {
19 | this.viewed = viewed;
20 | this.viewer = viewer;
21 | display = canSee;
22 | setType(Type.WHITE_POINTER);
23 | }
24 |
25 | /**
26 | * Get the viewing player.
27 | *
28 | * @return the player who holds the minimap
29 | */
30 | public Player getViewer()
31 | {
32 | return viewer;
33 | }
34 |
35 | /**
36 | * Get the player which shall be shown on the minimap.
37 | *
38 | * @return the player which shall be on the minimap
39 | */
40 | public Player getViewed()
41 | {
42 | return viewed;
43 | }
44 |
45 | /**
46 | * Get the type of cursor, the viewer sees for the viewed player.
47 | *
48 | * @return the cursor type
49 | */
50 | public Type getType()
51 | {
52 | return type;
53 | }
54 |
55 | /**
56 | * Set the type of cursor, the viewer sees for the viewed player.
57 | *
58 | * @param type the type of cursor
59 | */
60 | public void setType(Type type)
61 | {
62 | this.type = type;
63 | }
64 |
65 | /**
66 | * Get if the viewing player get a cursor displayed on his map for the
67 | * viewed player.
68 | *
69 | * @return true if shown, false if not
70 | */
71 | public boolean isCursorShown()
72 | {
73 | return display;
74 | }
75 |
76 | /**
77 | * Set whether the viewer gets a cursor for the viewed player on his map.
78 | *
79 | * @param display true if he shall see him, false if not
80 | */
81 | public void setCursorShown(boolean display)
82 | {
83 | this.display = display;
84 | }
85 |
86 | @Override
87 | public HandlerList getHandlers()
88 | {
89 | return handlers;
90 | }
91 |
92 | public static HandlerList getHandlerList()
93 | {
94 | return handlers;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/Waypoint.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import org.bukkit.map.MapCursor;
4 |
5 | import de.craftlancer.serverminimap.ExtraCursor;
6 |
7 | public class Waypoint extends ExtraCursor
8 | {
9 | private String name;
10 |
11 | public Waypoint(int x, int z, boolean visible, MapCursor.Type type, byte direction, String world, boolean outside, String name)
12 | {
13 | super(x, z, visible, type, direction, world, outside);
14 | this.name = name;
15 | }
16 |
17 | /**
18 | * Get the name of the waypoint.
19 | *
20 | * @return the name of the waypoint, if not set it returns "". (Empty String)
21 | */
22 | public String getName()
23 | {
24 | return name;
25 | }
26 |
27 | /**
28 | * Set the name of the waypoint.
29 | * Names are NOT unique.
30 | *
31 | * @param name
32 | * the new name
33 | */
34 | public void setName(String name)
35 | {
36 | this.name = name;
37 | }
38 |
39 | @Override
40 | public String toString()
41 | {
42 | return super.toString() + " " + name;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointAddCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import org.bukkit.command.Command;
4 | import org.bukkit.command.CommandSender;
5 | import org.bukkit.entity.Player;
6 |
7 | import de.craftlancer.serverminimap.ServerMinimap;
8 |
9 | public class WaypointAddCommand extends WaypointSubCommand
10 | {
11 |
12 | public WaypointAddCommand(String permission, ServerMinimap plugin)
13 | {
14 | super(permission, plugin, false);
15 | }
16 |
17 | @Override
18 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
19 | {
20 | if (!checkSender(sender))
21 | sender.sendMessage("You don't have permission for this command!");
22 | else if (args.length < 1)
23 | help(sender);
24 | else
25 | {
26 | int x;
27 | int z;
28 | String world;
29 | String name;
30 |
31 | if (args.length == 2)
32 | name = args[1];
33 | else if (args.length >= 5)
34 | name = args[4];
35 | else
36 | name = "";
37 |
38 | if (args.length >= 3)
39 | try
40 | {
41 | x = Integer.parseInt(args[1]);
42 | z = Integer.parseInt(args[2]);
43 | }
44 | catch (NumberFormatException e)
45 | {
46 | sender.sendMessage(args[1] + " or " + args[2] + " are not a number!");
47 | return;
48 | }
49 | else
50 | {
51 | x = ((Player) sender).getLocation().getBlockX();
52 | z = ((Player) sender).getLocation().getBlockZ();
53 | }
54 |
55 | if (args.length >= 4)
56 | world = args[3];
57 | else
58 | world = ((Player) sender).getWorld().getName();
59 |
60 | plugin.getWaypointHandler().addWaypoint(((Player) sender).getUniqueId(), x, z, world, name);
61 | sender.sendMessage("Waypoint added!");
62 | }
63 | }
64 |
65 | @Override
66 | public void help(CommandSender sender)
67 | {
68 | sender.sendMessage("/waypoint add [name] for waypoint on your location, /waypoint add [world] [name] for remote waypoint.");
69 | sender.sendMessage("If you want a remote waypoint with a name you HAVE TO specify the world.");
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointCommandHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import java.util.Collection;
4 | import java.util.HashMap;
5 | import java.util.LinkedList;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | import org.apache.commons.lang.Validate;
10 | import org.bukkit.command.Command;
11 | import org.bukkit.command.CommandSender;
12 | import org.bukkit.command.TabExecutor;
13 |
14 | import de.craftlancer.serverminimap.ServerMinimap;
15 |
16 | public class WaypointCommandHandler implements TabExecutor
17 | {
18 | private HashMap commands = new HashMap();
19 |
20 | public WaypointCommandHandler(ServerMinimap plugin)
21 | {
22 | commands.put("help", new WaypointHelpCommand("minimap.command.waypoint.help", plugin));
23 | commands.put("list", new WaypointListCommand("minimap.command.waypoint.list", plugin));
24 | commands.put("add", new WaypointAddCommand("minimap.command.waypoint.add", plugin));
25 | commands.put("remove", new WaypointRemoveCommand("minimap.command.waypoint.remove", plugin));
26 | commands.put("hide", new WaypointHideCommand("minimap.command.waypoint.hide", plugin));
27 | commands.put("getid", new WaypointGetIdCommand("minimap.command.waypoint.getid", plugin));
28 | commands.put("setname", new WaypointSetNameCommand("minimap.command.waypoint.setname", plugin));
29 | }
30 |
31 | @Override
32 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
33 | {
34 | if (args.length == 0 || !commands.containsKey(args[0]))
35 | if (commands.containsKey("help"))
36 | commands.get("help").execute(sender, cmd, label, args);
37 | else
38 | return false;
39 | else
40 | commands.get(args[0]).execute(sender, cmd, label, args);
41 |
42 | return true;
43 | }
44 |
45 | @Override
46 | public List onTabComplete(CommandSender sender, Command cmd, String label, String[] args)
47 | {
48 | switch (args.length)
49 | {
50 | case 0:
51 | return null;
52 | case 1:
53 | List l = getMatches(args[0], commands.keySet());
54 | for (String str : l)
55 | if (!sender.hasPermission(commands.get(str).getPermission()))
56 | l.remove(l);
57 | return l;
58 | default:
59 | if (!commands.containsKey(args[0]))
60 | return null;
61 | else
62 | return commands.get(args[0]).onTabComplete(sender, args);
63 | }
64 | }
65 |
66 | public void registerSubCommand(String name, WaypointSubCommand command, String... alias)
67 | {
68 | Validate.notNull(command, "Command can't be null!");
69 | Validate.notEmpty(name, "Commandname can't be empty!");
70 | commands.put(name, command);
71 | for (String s : alias)
72 | commands.put(s, command);
73 | }
74 |
75 | protected Map getCommands()
76 | {
77 | return commands;
78 | }
79 |
80 | public static List getMatches(String value, Collection list)
81 | {
82 | List result = new LinkedList();
83 |
84 | for (String str : list)
85 | if (str.startsWith(value))
86 | result.add(str);
87 |
88 | return result;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointGetIdCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import java.util.Map;
4 |
5 | import org.bukkit.command.Command;
6 | import org.bukkit.command.CommandSender;
7 | import org.bukkit.entity.Player;
8 |
9 | import de.craftlancer.serverminimap.ServerMinimap;
10 |
11 | public class WaypointGetIdCommand extends WaypointSubCommand
12 | {
13 |
14 | public WaypointGetIdCommand(String permission, ServerMinimap plugin)
15 | {
16 | super(permission, plugin, false);
17 | }
18 |
19 | @Override
20 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
21 | {
22 | if (!checkSender(sender))
23 | sender.sendMessage("You don't have permission for this command!");
24 | else if (args.length > 2)
25 | sender.sendMessage("You need to specify a name!");
26 | else
27 | {
28 | Map matchingWaypoints = plugin.getWaypointHandler().getMatchingWaypoints(((Player) sender).getUniqueId(), args[1]);
29 |
30 | sender.sendMessage(args[1] + " matches to the following IDs: ");
31 | StringBuilder str = new StringBuilder();
32 | for (Integer i : matchingWaypoints.keySet())
33 | str.append(i).append(" ");
34 |
35 | sender.sendMessage(str.toString());
36 | }
37 | }
38 |
39 | @Override
40 | public void help(CommandSender sender)
41 | {
42 | sender.sendMessage("/waypoint getid - get a list of waypoint ids, that have the given name.");
43 | sender.sendMessage("This is mainly used for the setName command.");
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointHandler.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 | import java.util.UUID;
8 |
9 | import org.bukkit.event.EventHandler;
10 | import org.bukkit.event.EventPriority;
11 | import org.bukkit.event.Listener;
12 | import org.bukkit.map.MapCursor;
13 |
14 | import de.craftlancer.serverminimap.ServerMinimap;
15 | import de.craftlancer.serverminimap.data.ConfigHandler;
16 | import de.craftlancer.serverminimap.data.DataHandler;
17 | import de.craftlancer.serverminimap.data.MySQL;
18 | import de.craftlancer.serverminimap.event.MinimapExtraCursorEvent;
19 |
20 | public class WaypointHandler implements Listener
21 | {
22 | private ServerMinimap plugin;
23 | private Map> waypoints = new HashMap>();
24 | private DataHandler handler;
25 |
26 | public WaypointHandler(ServerMinimap plugin)
27 | {
28 | this.plugin = plugin;
29 | if (plugin.getConfig().getBoolean("mysql.enabled", false))
30 | {
31 | String host = plugin.getConfig().getString("mysql.host");
32 | int port = plugin.getConfig().getInt("mysql.port");
33 | String user = plugin.getConfig().getString("mysql.user");
34 | String pass = plugin.getConfig().getString("mysql.pass");
35 | String database = plugin.getConfig().getString("mysql.database");
36 | String prefix = plugin.getConfig().getString("mysql.table_prefix");
37 |
38 | handler = new MySQL(plugin, host, port, user, pass, database, prefix);
39 | }
40 | else
41 | handler = new ConfigHandler(plugin);
42 | }
43 |
44 | public DataHandler getDataHandler()
45 | {
46 | return handler;
47 | }
48 |
49 | @EventHandler(priority = EventPriority.LOWEST)
50 | public void onMinimapExtraCursor(MinimapExtraCursorEvent e)
51 | {
52 | e.getCursors().addAll(getWaypoints(e.getPlayer().getUniqueId()));
53 | }
54 |
55 | public void load()
56 | {
57 | waypoints = handler.loadWaypoints();
58 | }
59 |
60 | public void save()
61 | {
62 | handler.saveWaypoints(waypoints);
63 | }
64 |
65 | public boolean addWaypoint(UUID player, int x, int z, String world, String name)
66 | {
67 | if (player == null || world == null)
68 | return false;
69 |
70 | if (!waypoints.containsKey(player))
71 | waypoints.put(player, new ArrayList());
72 |
73 | handler.addWaypoint(player, x, z, world, true, "");
74 | return waypoints.get(player).add(new Waypoint(x, z, true, MapCursor.Type.WHITE_CROSS, (byte) 0, world, plugin.showDistantWaypoints(), name));
75 | }
76 |
77 | public boolean removeWaypoint(UUID name, int index)
78 | {
79 | List wp = getWaypoints(name);
80 | if (index < 0 || wp == null || wp.size() == 0 || wp.size() < index || getWaypoints(name).contains(index))
81 | return false;
82 |
83 | handler.removeWaypoint(name, getWaypoints(name).get(index));
84 |
85 | return getWaypoints(name).remove(index) != null;
86 | }
87 |
88 | public Waypoint getWaypoint(UUID name, int index)
89 | {
90 | List wp = getWaypoints(name);
91 | if (index < 0 || wp == null || wp.size() == 0 || wp.size() < index)
92 | return null;
93 |
94 | return getWaypoints(name).get(index);
95 | }
96 |
97 | public List getWaypoints(UUID player)
98 | {
99 | if (!waypoints.containsKey(player))
100 | waypoints.put(player, new ArrayList());
101 |
102 | return waypoints.get(player);
103 | }
104 |
105 | public Map getMatchingWaypoints(UUID name, String string)
106 | {
107 | List localWaypoints = getWaypoints(name);
108 | Map match = new HashMap();
109 |
110 | for (int i = 0; localWaypoints.size() > i; i++)
111 | if (localWaypoints.get(i).getName().equalsIgnoreCase(string) || String.valueOf(i + 1).equals(string))
112 | match.put(i + 1, localWaypoints.get(i));
113 |
114 | return match;
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointHelpCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import org.bukkit.command.Command;
4 | import org.bukkit.command.CommandSender;
5 |
6 | import de.craftlancer.serverminimap.ServerMinimap;
7 |
8 | public class WaypointHelpCommand extends WaypointSubCommand
9 | {
10 |
11 | public WaypointHelpCommand(String permission, ServerMinimap plugin)
12 | {
13 | super(permission, plugin, true);
14 | }
15 |
16 | @Override
17 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
18 | {
19 | if (!checkSender(sender))
20 | sender.sendMessage("You don't have permission for this command!");
21 | else
22 | {
23 | sender.sendMessage("/waypoint help [command] - this command");
24 | sender.sendMessage("/waypoint add [x] [z] - adds a new waypoint to your position or to x,z");
25 | sender.sendMessage("/waypoint hide - toggle visibility of a waypoint.");
26 | sender.sendMessage("/waypoint setname - rename a waypoint.");
27 | sender.sendMessage("/waypoint getid - Get the waypoint ids, that match the given name.");
28 | sender.sendMessage("/waypoint list - list all your waypoints");
29 | sender.sendMessage("/waypoint remove - remove the waypoint with the given index.");
30 | }
31 | }
32 |
33 | @Override
34 | public void help(CommandSender sender)
35 | {
36 | sender.sendMessage("Shows help for waypoint commands.");
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointHideCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import java.util.Map;
4 |
5 | import org.bukkit.command.Command;
6 | import org.bukkit.command.CommandSender;
7 | import org.bukkit.entity.Player;
8 |
9 | import de.craftlancer.serverminimap.ServerMinimap;
10 |
11 | public class WaypointHideCommand extends WaypointSubCommand
12 | {
13 |
14 | public WaypointHideCommand(String permission, ServerMinimap plugin)
15 | {
16 | super(permission, plugin, false);
17 | }
18 |
19 | @Override
20 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
21 | {
22 | if (!checkSender(sender))
23 | sender.sendMessage("You don't have permission for this command!");
24 | else if (args.length < 2)
25 | sender.sendMessage("You need to specify a index!");
26 | else
27 | {
28 | Map w = plugin.getWaypointHandler().getMatchingWaypoints(((Player) sender).getUniqueId(), args[1]);
29 |
30 | if (w.isEmpty())
31 | {
32 | sender.sendMessage("There are no waypoints with this index/name!");
33 | return;
34 | }
35 |
36 | for (Waypoint entry : w.values())
37 | {
38 | boolean hide;
39 |
40 | if (args.length >= 3 && args[2].equalsIgnoreCase("true"))
41 | hide = false;
42 | else if (args.length >= 3 && args[2].equalsIgnoreCase("false"))
43 | hide = true;
44 | else
45 | hide = !entry.isVisible();
46 |
47 | entry.setVisible(hide);
48 | plugin.getWaypointHandler().getDataHandler().updateVisible(((Player) sender).getUniqueId(), entry, hide);
49 | }
50 | sender.sendMessage("Changed visibility of " + w.size() + " waypoints!");
51 | }
52 | }
53 |
54 | @Override
55 | public void help(CommandSender sender)
56 | {
57 | sender.sendMessage("/waypoint hide [true/false] - hide/unhide a waypoint with an index or name");
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointListCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import org.bukkit.command.Command;
4 | import org.bukkit.command.CommandSender;
5 | import org.bukkit.entity.Player;
6 |
7 | import de.craftlancer.serverminimap.ServerMinimap;
8 |
9 | public class WaypointListCommand extends WaypointSubCommand
10 | {
11 |
12 | public WaypointListCommand(String permission, ServerMinimap plugin)
13 | {
14 | super(permission, plugin, false);
15 | }
16 |
17 | @Override
18 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
19 | {
20 | if (!checkSender(sender))
21 | sender.sendMessage("You don't have permission for this command!");
22 | else
23 | {
24 | int i = 1;
25 | for (Waypoint w : plugin.getWaypointHandler().getWaypoints(((Player) sender).getUniqueId()))
26 | sender.sendMessage(i++ + " Name: " + w.getName() + " X: " + w.getX() + " Z: " + w.getZ() + " Visible: " + w.isVisible());
27 | }
28 | }
29 |
30 | @Override
31 | public void help(CommandSender sender)
32 | {
33 | sender.sendMessage("List all your waypoints with their index.");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointRemoveCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import java.util.Map;
4 |
5 | import org.bukkit.command.Command;
6 | import org.bukkit.command.CommandSender;
7 | import org.bukkit.entity.Player;
8 |
9 | import de.craftlancer.serverminimap.ServerMinimap;
10 |
11 | public class WaypointRemoveCommand extends WaypointSubCommand
12 | {
13 |
14 | public WaypointRemoveCommand(String permission, ServerMinimap plugin)
15 | {
16 | super(permission, plugin, false);
17 | }
18 |
19 | @Override
20 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
21 | {
22 | if (!checkSender(sender))
23 | sender.sendMessage("You don't have permission for this command!");
24 | else if (args.length > 2)
25 | sender.sendMessage("You need to specify a index or a name!");
26 | else
27 | {
28 | Map matchingWaypoints = plugin.getWaypointHandler().getMatchingWaypoints(((Player) sender).getUniqueId(), args[1]);
29 |
30 | if (matchingWaypoints.isEmpty())
31 | {
32 | sender.sendMessage("No matching waypoint found!");
33 | return;
34 | }
35 |
36 | int i = 0;
37 |
38 | for (Integer index : matchingWaypoints.keySet())
39 | if (plugin.getWaypointHandler().removeWaypoint(((Player) sender).getUniqueId(), index - 1))
40 | i++;
41 |
42 | sender.sendMessage(i + " Waypoint(s) removed!");
43 | }
44 | }
45 |
46 | @Override
47 | public void help(CommandSender sender)
48 | {
49 | sender.sendMessage("/waypoint remove - remove the waypoint of this index, see /waypoint list for the indicies.");
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointSetNameCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import org.bukkit.command.Command;
4 | import org.bukkit.command.CommandSender;
5 | import org.bukkit.entity.Player;
6 |
7 | import de.craftlancer.serverminimap.ServerMinimap;
8 |
9 | public class WaypointSetNameCommand extends WaypointSubCommand
10 | {
11 |
12 | public WaypointSetNameCommand(String permission, ServerMinimap plugin)
13 | {
14 | super(permission, plugin, false);
15 | }
16 |
17 | @Override
18 | protected void execute(CommandSender sender, Command cmd, String label, String[] args)
19 | {
20 | if (!checkSender(sender))
21 | sender.sendMessage("You don't have permission for this command!");
22 | else if (args.length < 3)
23 | sender.sendMessage("You need to specify a index and a new name!");
24 | else
25 | {
26 | int index;
27 |
28 | try
29 | {
30 | index = Integer.parseInt(args[1]);
31 | }
32 | catch (NumberFormatException e)
33 | {
34 | sender.sendMessage("The given value it not a number!");
35 | return;
36 | }
37 |
38 | Waypoint wp = plugin.getWaypointHandler().getWaypoint(((Player) sender).getUniqueId(), index - 1);
39 | wp.setName(args[2]);
40 | plugin.getWaypointHandler().getDataHandler().updateName(((Player) sender).getUniqueId(), wp);
41 | sender.sendMessage("Name set!");
42 | }
43 | }
44 |
45 | @Override
46 | public void help(CommandSender sender)
47 | {
48 | sender.sendMessage("/waypoint setname - set the the name of the waypoint with the given index.");
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/de/craftlancer/serverminimap/waypoint/WaypointSubCommand.java:
--------------------------------------------------------------------------------
1 | package de.craftlancer.serverminimap.waypoint;
2 |
3 | import java.util.List;
4 |
5 | import org.bukkit.command.Command;
6 | import org.bukkit.command.CommandSender;
7 | import org.bukkit.entity.Player;
8 |
9 | import de.craftlancer.serverminimap.ServerMinimap;
10 |
11 | public abstract class WaypointSubCommand
12 | {
13 | private String permission = "";
14 | protected ServerMinimap plugin;
15 | private boolean console;
16 |
17 | public WaypointSubCommand(String permission, ServerMinimap plugin, boolean console)
18 | {
19 | this.permission = permission;
20 | this.plugin = plugin;
21 | this.console = console;
22 | }
23 |
24 | public boolean checkSender(CommandSender sender)
25 | {
26 | if (!(sender instanceof Player) && isConsoleCommand())
27 | return true;
28 |
29 | if (sender.hasPermission(getPermission()))
30 | return true;
31 |
32 | return false;
33 | }
34 |
35 | public ServerMinimap getPlugin()
36 | {
37 | return plugin;
38 | }
39 |
40 | public boolean isConsoleCommand()
41 | {
42 | return console;
43 | }
44 |
45 | public String getPermission()
46 | {
47 | return permission;
48 | }
49 |
50 | protected abstract void execute(CommandSender sender, Command cmd, String label, String[] args);
51 |
52 | @SuppressWarnings("unused")
53 | protected List onTabComplete(CommandSender sender, String[] args)
54 | {
55 | return null;
56 | }
57 |
58 | public abstract void help(CommandSender sender);
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/resources/config.yml:
--------------------------------------------------------------------------------
1 | scale: 1
2 | chunksPerRun: 4
3 | runPerTicks: 5
4 | fastTicks: 20
5 | canSeeOthers: true
6 | showDistantWaypoints: false
7 | mysql:
8 | enabled: false
9 | host: localhost
10 | port: 3306
11 | user: user
12 | pass: password
13 | database: database
14 | worlds:
15 | world_nether:
16 | enabled: true
17 | drawHeight: 75
18 | scale: 2
--------------------------------------------------------------------------------
/src/main/resources/plugin.yml:
--------------------------------------------------------------------------------
1 | name: ServerMinimap
2 | main: de.craftlancer.serverminimap.ServerMinimap
3 | version: ${project.version}
4 | author: SydMontague
5 | description: A serverside Minimap via maps.
6 | api-version: 1.13
7 | permissions:
8 | minimap.fastupdate:
9 | description: Updates the minimap of the player much faster
10 | default: false
11 | commands:
12 | waypoint:
13 | usage: /waypoint help
14 | aliases: [wp, mwp]
15 | minimap:
16 | usage: /minimap
17 | description: Gives you a minimap item
18 | permissions:
19 | minimap.fastupdate:
20 | default: false
21 | minimap.command.waypoint.help:
22 | default: false
23 | minimap.command.waypoint.list:
24 | default: false
25 | minimap.command.waypoint.add:
26 | default: false
27 | minimap.command.waypoint.remove:
28 | default: false
29 | minimap.command.waypoint.hide:
30 | default: false
31 | minimap.command.minimap:
32 | default: op
--------------------------------------------------------------------------------