Skip to content

Commit 0c6ae52

Browse files
committed
Project Tidy up
Improved package names and updated maven settings
1 parent 57a1180 commit 0c6ae52

40 files changed

+230
-223
lines changed

pom.xml

+13-8
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<!-- bStats -->
8585
<dependency>
8686
<groupId>org.bstats</groupId>
87-
<artifactId>bstats-bukkit</artifactId>
87+
<artifactId>bstats-bukkit-lite</artifactId>
8888
<version>1.7</version>
8989
<scope>compile</scope>
9090
</dependency>
@@ -104,16 +104,12 @@
104104

105105
<build>
106106
<finalName>${project.artifactId}</finalName>
107-
<defaultGoal>clean compile resources:resources package shade:shade</defaultGoal>
107+
<defaultGoal>clean package</defaultGoal>
108108

109109
<resources>
110110
<resource>
111-
<targetPath>.</targetPath>
111+
<directory>src/main/resources</directory>
112112
<filtering>true</filtering>
113-
<directory>${basedir}</directory>
114-
<includes>
115-
<include>plugin.yml</include>
116-
</includes>
117113
</resource>
118114
</resources>
119115

@@ -144,15 +140,24 @@
144140
<artifactId>maven-shade-plugin</artifactId>
145141
<version>3.2.2</version>
146142
<configuration>
143+
<createDependencyReducedPom>false</createDependencyReducedPom>
147144
<artifactSet>
148145
<includes>
149146
<include>org.bstats:*</include>
150147
</includes>
151148
</artifactSet>
149+
<filters>
150+
<filter>
151+
<artifact>*:*</artifact>
152+
<excludes>
153+
<exclude>META-INF/</exclude>
154+
</excludes>
155+
</filter>
156+
</filters>
152157
<relocations>
153158
<relocation>
154159
<pattern>org.bstats</pattern>
155-
<shadedPattern>io.github.a5h73y.Carz</shadedPattern>
160+
<shadedPattern>io.github.a5h73y.carz</shadedPattern>
156161
</relocation>
157162
</relocations>
158163
</configuration>

src/main/java/io/github/a5h73y/Carz.java src/main/java/io/github/a5h73y/carz/Carz.java

+27-19
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
package io.github.a5h73y;
2-
3-
import io.github.a5h73y.commands.CarzAutoTabCompleter;
4-
import io.github.a5h73y.commands.CarzCommands;
5-
import io.github.a5h73y.commands.CarzConsoleCommands;
6-
import io.github.a5h73y.configuration.Settings;
7-
import io.github.a5h73y.controllers.CarController;
8-
import io.github.a5h73y.controllers.FuelController;
9-
import io.github.a5h73y.listeners.PlayerListener;
10-
import io.github.a5h73y.listeners.SignListener;
11-
import io.github.a5h73y.listeners.VehicleListener;
12-
import io.github.a5h73y.other.CarzUpdater;
13-
import io.github.a5h73y.plugin.BountifulAPI;
14-
import io.github.a5h73y.plugin.EconomyAPI;
15-
import io.github.a5h73y.utility.ItemMetaUtils;
16-
import io.github.a5h73y.utility.TranslationUtils;
17-
import org.bstats.bukkit.Metrics;
1+
package io.github.a5h73y.carz;
2+
3+
import io.github.a5h73y.carz.commands.CarzAutoTabCompleter;
4+
import io.github.a5h73y.carz.commands.CarzCommands;
5+
import io.github.a5h73y.carz.commands.CarzConsoleCommands;
6+
import io.github.a5h73y.carz.configuration.Settings;
7+
import io.github.a5h73y.carz.controllers.CarController;
8+
import io.github.a5h73y.carz.controllers.FuelController;
9+
import io.github.a5h73y.carz.listeners.PlayerListener;
10+
import io.github.a5h73y.carz.listeners.SignListener;
11+
import io.github.a5h73y.carz.listeners.VehicleListener;
12+
import io.github.a5h73y.carz.other.CarzUpdater;
13+
import io.github.a5h73y.carz.other.PluginUtils;
14+
import io.github.a5h73y.carz.plugin.BountifulAPI;
15+
import io.github.a5h73y.carz.plugin.EconomyAPI;
16+
import io.github.a5h73y.carz.utility.ItemMetaUtils;
17+
import io.github.a5h73y.carz.utility.TranslationUtils;
18+
import org.bstats.bukkit.MetricsLite;
1819
import org.bukkit.plugin.java.JavaPlugin;
1920

2021
public class Carz extends JavaPlugin {
2122

23+
private static final int PLUGIN_ID = 42269;
2224
private static Carz instance;
2325

2426
private BountifulAPI bountifulAPI;
@@ -48,10 +50,16 @@ public void onEnable() {
4850
setupPlugins();
4951

5052
getLogger().info("Enabled Carz v" + getDescription().getVersion());
51-
new Metrics(this, 42269);
53+
new MetricsLite(this, PLUGIN_ID);
5254
updatePlugin();
5355
}
5456

57+
@Override
58+
public void onDisable() {
59+
PluginUtils.log("Disabled Carz v" + getDescription().getVersion());
60+
instance = null;
61+
}
62+
5563
private void setupPlugins() {
5664
bountifulAPI = new BountifulAPI();
5765
economyAPI = new EconomyAPI();
@@ -77,7 +85,7 @@ public static String getPrefix() {
7785

7886
private void updatePlugin() {
7987
if (getConfig().getBoolean("Other.UpdateCheck")) {
80-
new CarzUpdater(this, 42269, this.getFile(), CarzUpdater.UpdateType.DEFAULT, true);
88+
new CarzUpdater(this, PLUGIN_ID, this.getFile(), CarzUpdater.UpdateType.DEFAULT, true);
8189
}
8290
}
8391

src/main/java/io/github/a5h73y/commands/CarzAutoTabCompleter.java src/main/java/io/github/a5h73y/carz/commands/CarzAutoTabCompleter.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package io.github.a5h73y.commands;
1+
package io.github.a5h73y.carz.commands;
22

33
import java.util.ArrayList;
44
import java.util.List;
55

6-
import io.github.a5h73y.Carz;
7-
import io.github.a5h73y.enums.Commands;
8-
import io.github.a5h73y.enums.Permissions;
9-
import io.github.a5h73y.other.AbstractPluginReceiver;
10-
import io.github.a5h73y.utility.PermissionUtils;
6+
import io.github.a5h73y.carz.Carz;
7+
import io.github.a5h73y.carz.enums.Commands;
8+
import io.github.a5h73y.carz.enums.Permissions;
9+
import io.github.a5h73y.carz.other.AbstractPluginReceiver;
10+
import io.github.a5h73y.carz.utility.PermissionUtils;
1111
import org.bukkit.command.Command;
1212
import org.bukkit.command.CommandSender;
1313
import org.bukkit.command.TabCompleter;

src/main/java/io/github/a5h73y/commands/CarzCommands.java src/main/java/io/github/a5h73y/carz/commands/CarzCommands.java

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
package io.github.a5h73y.commands;
2-
3-
import io.github.a5h73y.Carz;
4-
import io.github.a5h73y.conversation.CreateCarTypeConversation;
5-
import io.github.a5h73y.enums.Commands;
6-
import io.github.a5h73y.enums.Permissions;
7-
import io.github.a5h73y.enums.VehicleDetailKey;
8-
import io.github.a5h73y.model.Car;
9-
import io.github.a5h73y.other.AbstractPluginReceiver;
10-
import io.github.a5h73y.other.CarzHelp;
11-
import io.github.a5h73y.other.DelayTasks;
12-
import io.github.a5h73y.other.PluginUtils;
13-
import io.github.a5h73y.purchases.CarPurchase;
14-
import io.github.a5h73y.purchases.Purchasable;
15-
import io.github.a5h73y.purchases.RefuelPurchase;
16-
import io.github.a5h73y.purchases.UpgradePurchase;
17-
import io.github.a5h73y.utility.CarUtils;
18-
import io.github.a5h73y.utility.PermissionUtils;
19-
import io.github.a5h73y.utility.StringUtils;
20-
import io.github.a5h73y.utility.TranslationUtils;
21-
import io.github.a5h73y.utility.ValidationUtils;
1+
package io.github.a5h73y.carz.commands;
2+
3+
import io.github.a5h73y.carz.Carz;
4+
import io.github.a5h73y.carz.conversation.CreateCarTypeConversation;
5+
import io.github.a5h73y.carz.enums.Commands;
6+
import io.github.a5h73y.carz.enums.Permissions;
7+
import io.github.a5h73y.carz.enums.VehicleDetailKey;
8+
import io.github.a5h73y.carz.model.Car;
9+
import io.github.a5h73y.carz.other.AbstractPluginReceiver;
10+
import io.github.a5h73y.carz.other.CarzHelp;
11+
import io.github.a5h73y.carz.other.DelayTasks;
12+
import io.github.a5h73y.carz.other.PluginUtils;
13+
import io.github.a5h73y.carz.purchases.CarPurchase;
14+
import io.github.a5h73y.carz.purchases.Purchasable;
15+
import io.github.a5h73y.carz.purchases.RefuelPurchase;
16+
import io.github.a5h73y.carz.purchases.UpgradePurchase;
17+
import io.github.a5h73y.carz.utility.CarUtils;
18+
import io.github.a5h73y.carz.utility.PermissionUtils;
19+
import io.github.a5h73y.carz.utility.StringUtils;
20+
import io.github.a5h73y.carz.utility.TranslationUtils;
21+
import io.github.a5h73y.carz.utility.ValidationUtils;
2222
import org.bukkit.ChatColor;
2323
import org.bukkit.command.Command;
2424
import org.bukkit.command.CommandExecutor;
@@ -27,7 +27,7 @@
2727
import org.bukkit.entity.Player;
2828
import org.bukkit.entity.Vehicle;
2929

30-
import static io.github.a5h73y.controllers.CarController.DEFAULT_CAR;
30+
import static io.github.a5h73y.carz.controllers.CarController.DEFAULT_CAR;
3131

3232
/**
3333
* Player-related Carz commands handling.

src/main/java/io/github/a5h73y/commands/CarzConsoleCommands.java src/main/java/io/github/a5h73y/carz/commands/CarzConsoleCommands.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package io.github.a5h73y.commands;
2-
3-
import io.github.a5h73y.Carz;
4-
import io.github.a5h73y.conversation.CreateCarTypeConversation;
5-
import io.github.a5h73y.enums.Commands;
6-
import io.github.a5h73y.other.AbstractPluginReceiver;
7-
import io.github.a5h73y.other.PluginUtils;
8-
import io.github.a5h73y.utility.CarUtils;
9-
import io.github.a5h73y.utility.TranslationUtils;
1+
package io.github.a5h73y.carz.commands;
2+
3+
import io.github.a5h73y.carz.Carz;
4+
import io.github.a5h73y.carz.conversation.CreateCarTypeConversation;
5+
import io.github.a5h73y.carz.enums.Commands;
6+
import io.github.a5h73y.carz.other.AbstractPluginReceiver;
7+
import io.github.a5h73y.carz.other.PluginUtils;
8+
import io.github.a5h73y.carz.utility.CarUtils;
9+
import io.github.a5h73y.carz.utility.TranslationUtils;
1010
import org.bukkit.Bukkit;
1111
import org.bukkit.ChatColor;
1212
import org.bukkit.command.Command;
@@ -15,7 +15,7 @@
1515
import org.bukkit.command.ConsoleCommandSender;
1616
import org.bukkit.entity.Player;
1717

18-
import static io.github.a5h73y.controllers.CarController.DEFAULT_CAR;
18+
import static io.github.a5h73y.carz.controllers.CarController.DEFAULT_CAR;
1919

2020
/**
2121
* Console-related Carz commands handling.

src/main/java/io/github/a5h73y/configuration/Settings.java src/main/java/io/github/a5h73y/carz/configuration/Settings.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package io.github.a5h73y.configuration;
1+
package io.github.a5h73y.carz.configuration;
22

33
import java.io.File;
44
import java.io.IOException;
55
import java.util.List;
66
import java.util.Set;
77

8-
import io.github.a5h73y.Carz;
9-
import io.github.a5h73y.other.AbstractPluginReceiver;
10-
import io.github.a5h73y.other.PluginUtils;
11-
import io.github.a5h73y.utility.TranslationUtils;
8+
import io.github.a5h73y.carz.Carz;
9+
import io.github.a5h73y.carz.other.AbstractPluginReceiver;
10+
import io.github.a5h73y.carz.other.PluginUtils;
11+
import io.github.a5h73y.carz.utility.TranslationUtils;
1212
import org.bukkit.Material;
1313
import org.bukkit.configuration.file.FileConfiguration;
1414
import org.bukkit.configuration.file.YamlConfiguration;

src/main/java/io/github/a5h73y/controllers/CarController.java src/main/java/io/github/a5h73y/carz/controllers/CarController.java

+18-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
package io.github.a5h73y.controllers;
1+
package io.github.a5h73y.carz.controllers;
22

33
import java.util.HashMap;
44
import java.util.Map;
55
import java.util.Set;
66

7-
import io.github.a5h73y.Carz;
8-
import io.github.a5h73y.enums.Permissions;
9-
import io.github.a5h73y.model.Car;
10-
import io.github.a5h73y.model.CarDetails;
11-
import io.github.a5h73y.other.AbstractPluginReceiver;
12-
import io.github.a5h73y.utility.CarUtils;
13-
import io.github.a5h73y.utility.EffectUtils;
14-
import io.github.a5h73y.utility.PermissionUtils;
15-
import io.github.a5h73y.utility.TranslationUtils;
7+
import io.github.a5h73y.carz.Carz;
8+
import io.github.a5h73y.carz.enums.Permissions;
9+
import io.github.a5h73y.carz.enums.VehicleDetailKey;
10+
import io.github.a5h73y.carz.model.Car;
11+
import io.github.a5h73y.carz.model.CarDetails;
12+
import io.github.a5h73y.carz.other.AbstractPluginReceiver;
13+
import io.github.a5h73y.carz.utility.CarUtils;
14+
import io.github.a5h73y.carz.utility.EffectUtils;
15+
import io.github.a5h73y.carz.utility.PermissionUtils;
16+
import io.github.a5h73y.carz.utility.TranslationUtils;
1617
import org.bukkit.Effect;
1718
import org.bukkit.entity.Minecart;
1819
import org.bukkit.entity.Player;
1920
import org.bukkit.entity.Vehicle;
2021

21-
import static io.github.a5h73y.enums.VehicleDetailKey.VEHICLE_FUEL;
22-
import static io.github.a5h73y.enums.VehicleDetailKey.VEHICLE_OWNER;
23-
import static io.github.a5h73y.enums.VehicleDetailKey.VEHICLE_SPEED;
24-
import static io.github.a5h73y.enums.VehicleDetailKey.VEHICLE_TYPE;
25-
2622
/**
2723
* All Car related functionality.
2824
*/
@@ -65,14 +61,14 @@ public void populateCarTypes() {
6561
* @param vehicle vehicle the player is driving
6662
*/
6763
public void startDriving(String playerName, Vehicle vehicle) {
68-
String carType = carz.getItemMetaUtils().getValue(VEHICLE_TYPE, vehicle);
64+
String carType = carz.getItemMetaUtils().getValue(VehicleDetailKey.VEHICLE_TYPE, vehicle);
6965
Car car = getOrCreateCar(vehicle.getEntityId(), carType);
7066

71-
if (carz.getItemMetaUtils().has(VEHICLE_SPEED, vehicle)) {
72-
car.setMaxSpeed(Double.parseDouble(carz.getItemMetaUtils().getValue(VEHICLE_SPEED, vehicle)));
67+
if (carz.getItemMetaUtils().has(VehicleDetailKey.VEHICLE_SPEED, vehicle)) {
68+
car.setMaxSpeed(Double.parseDouble(carz.getItemMetaUtils().getValue(VehicleDetailKey.VEHICLE_SPEED, vehicle)));
7369
}
74-
if (carz.getItemMetaUtils().has(VEHICLE_FUEL, vehicle)) {
75-
car.setCurrentFuel(Double.parseDouble(carz.getItemMetaUtils().getValue(VEHICLE_FUEL, vehicle)));
70+
if (carz.getItemMetaUtils().has(VehicleDetailKey.VEHICLE_FUEL, vehicle)) {
71+
car.setCurrentFuel(Double.parseDouble(carz.getItemMetaUtils().getValue(VehicleDetailKey.VEHICLE_FUEL, vehicle)));
7672
}
7773

7874
playersDriving.put(playerName, car.getEntityId());
@@ -173,7 +169,7 @@ public void stashCar(Player player, Vehicle vehicle) {
173169
return;
174170
}
175171

176-
String owner = carz.getItemMetaUtils().getValue(VEHICLE_OWNER, vehicle);
172+
String owner = carz.getItemMetaUtils().getValue(VehicleDetailKey.VEHICLE_OWNER, vehicle);
177173

178174
if (!player.getName().equals(owner) && !PermissionUtils.hasStrictPermission(player, Permissions.ADMIN)) {
179175
return;
@@ -219,7 +215,7 @@ private void upgradeCarSpeed(Vehicle vehicle) {
219215
}
220216

221217
car.setMaxSpeed(currentMax + upgradeAmount);
222-
carz.getItemMetaUtils().setValue(VEHICLE_SPEED, vehicle, String.valueOf(car.getMaxSpeed()));
218+
carz.getItemMetaUtils().setValue(VehicleDetailKey.VEHICLE_SPEED, vehicle, String.valueOf(car.getMaxSpeed()));
223219
}
224220

225221
public Map<String, CarDetails> getCarTypes() {

src/main/java/io/github/a5h73y/controllers/FuelController.java src/main/java/io/github/a5h73y/carz/controllers/FuelController.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package io.github.a5h73y.controllers;
1+
package io.github.a5h73y.carz.controllers;
22

3-
import io.github.a5h73y.Carz;
4-
import io.github.a5h73y.model.Car;
5-
import io.github.a5h73y.other.AbstractPluginReceiver;
6-
import io.github.a5h73y.utility.TranslationUtils;
3+
import io.github.a5h73y.carz.Carz;
4+
import io.github.a5h73y.carz.model.Car;
5+
import io.github.a5h73y.carz.other.AbstractPluginReceiver;
6+
import io.github.a5h73y.carz.utility.TranslationUtils;
77
import org.bukkit.ChatColor;
88
import org.bukkit.entity.Minecart;
99
import org.bukkit.entity.Player;

src/main/java/io/github/a5h73y/conversation/CarzConversation.java src/main/java/io/github/a5h73y/carz/conversation/CarzConversation.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package io.github.a5h73y.conversation;
1+
package io.github.a5h73y.carz.conversation;
22

3-
import io.github.a5h73y.Carz;
3+
import io.github.a5h73y.carz.Carz;
44
import org.bukkit.ChatColor;
55
import org.bukkit.conversations.Conversable;
66
import org.bukkit.conversations.Conversation;

src/main/java/io/github/a5h73y/conversation/CreateCarTypeConversation.java src/main/java/io/github/a5h73y/carz/conversation/CreateCarTypeConversation.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package io.github.a5h73y.conversation;
1+
package io.github.a5h73y.carz.conversation;
22

33
import java.util.Arrays;
44
import java.util.HashMap;
55
import java.util.List;
66
import java.util.Map;
77
import java.util.regex.Pattern;
88

9-
import io.github.a5h73y.Carz;
10-
import io.github.a5h73y.utility.ValidationUtils;
9+
import io.github.a5h73y.carz.Carz;
10+
import io.github.a5h73y.carz.utility.ValidationUtils;
1111
import org.bukkit.ChatColor;
1212
import org.bukkit.Material;
1313
import org.bukkit.configuration.file.FileConfiguration;

src/main/java/io/github/a5h73y/enums/Commands.java src/main/java/io/github/a5h73y/carz/enums/Commands.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.a5h73y.enums;
1+
package io.github.a5h73y.carz.enums;
22

33
/**
44
* The configurable Commands.

src/main/java/io/github/a5h73y/enums/Permissions.java src/main/java/io/github/a5h73y/carz/enums/Permissions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.a5h73y.enums;
1+
package io.github.a5h73y.carz.enums;
22

33
/**
44
* All Carz related permissions.

src/main/java/io/github/a5h73y/enums/VehicleDetailKey.java src/main/java/io/github/a5h73y/carz/enums/VehicleDetailKey.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package io.github.a5h73y.enums;
1+
package io.github.a5h73y.carz.enums;
22

3-
import io.github.a5h73y.Carz;
3+
import io.github.a5h73y.carz.Carz;
44
import org.bukkit.NamespacedKey;
55

66
public enum VehicleDetailKey {

0 commit comments

Comments
 (0)