-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MylesAndMore/dev
refactoring!
- Loading branch information
Showing
20 changed files
with
744 additions
and
997 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = 'tumble' | ||
rootProject.name = 'Tumble' |
26 changes: 11 additions & 15 deletions
26
...in/java/com/MylesAndMore/tumble/Main.java → ...in/java/com/MylesAndMore/Tumble/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,35 @@ | ||
package com.MylesAndMore.tumble; | ||
package com.MylesAndMore.Tumble; | ||
|
||
import com.MylesAndMore.tumble.commands.*; | ||
import com.MylesAndMore.tumble.api.Metrics; | ||
import com.MylesAndMore.Tumble.commands.*; | ||
import com.MylesAndMore.Tumble.plugin.Metrics; | ||
import com.MylesAndMore.Tumble.plugin.Constants; | ||
import com.MylesAndMore.Tumble.plugin.EventListener; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public class Main extends JavaPlugin{ | ||
@Override | ||
public void onEnable() { | ||
// Register our event listener | ||
// Register setup items | ||
getServer().getPluginManager().registerEvents(new EventListener(), this); | ||
// Register commands | ||
this.getCommand("reload").setExecutor(new ReloadCommand()); | ||
this.getCommand("reload").setExecutor(new Reload()); | ||
this.getCommand("link").setExecutor(new SetWorldConfig()); | ||
this.getCommand("start").setExecutor(new StartGame()); | ||
this.getCommand("winlocation").setExecutor(new SetWinnerLoc()); | ||
this.getCommand("autostart").setExecutor(new SetAutoStart()); | ||
// Save the default config file (packaged in the JAR) | ||
this.saveDefaultConfig(); | ||
|
||
// Register bStats | ||
int pluginId = 16940; | ||
Metrics metrics = new Metrics(this, 16940); | ||
this.saveDefaultConfig(); // Saves the default config file (packaged in the JAR) if we haven't already\ | ||
|
||
// Check if worlds are null in config | ||
if (TumbleManager.getGameWorld() == null) { | ||
// Check if worlds are null in config and throw warnings if so | ||
if (Constants.getGameWorld() == null) { | ||
Bukkit.getServer().getLogger().warning("[Tumble] It appears you have not configured a game world for Tumble."); | ||
Bukkit.getServer().getLogger().info("[Tumble] If this is your first time running the plugin, you may disregard this message."); | ||
} | ||
if (TumbleManager.getLobbyWorld() == null) { | ||
if (Constants.getLobbyWorld() == null) { | ||
Bukkit.getServer().getLogger().warning("[Tumble] It appears you have not configured a lobby world for Tumble."); | ||
Bukkit.getServer().getLogger().info("[Tumble] If this is your first time running the plugin, you may disregard this message."); | ||
} | ||
|
||
// Init message | ||
Bukkit.getServer().getLogger().info("[Tumble] Tumble successfully enabled!"); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/MylesAndMore/Tumble/commands/Reload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.MylesAndMore.Tumble.commands; | ||
|
||
import com.MylesAndMore.Tumble.plugin.Constants; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class Reload implements CommandExecutor { | ||
@Override | ||
public boolean onCommand(CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { | ||
if (sender.hasPermission("tumble.reload")) { | ||
Constants.getPlugin().reloadConfig(); | ||
sender.sendMessage(ChatColor.GREEN + "Tumble configuration reloaded successfully."); | ||
} | ||
else { | ||
sender.sendMessage(ChatColor.RED + Constants.getPermissionMessage()); | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.