Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/me/taylorkelly/mywarp/ConnectionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

public class ConnectionManager {
private static Connection conn;
private static final WarpLogger logger = WarpLogger.getLogger();

public static Connection initialize() {
try {
Expand All @@ -22,9 +23,9 @@ public static Connection initialize() {
return conn;
}
} catch (SQLException ex) {
WarpLogger.severe("SQL exception on initialize", ex);
logger.severe("SQL exception on initialize", ex);
} catch (ClassNotFoundException ex) {
WarpLogger.severe("You need the SQLite/MySQL library.", ex);
logger.severe("You need the SQLite/MySQL library.", ex);
}
return conn;
}
Expand All @@ -40,7 +41,7 @@ public static void closeConnection() {
conn.close();
conn = null;
} catch (SQLException ex) {
WarpLogger.severe("Error on Connection close", ex);
logger.severe("Error on Connection close", ex);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/me/taylorkelly/mywarp/MWPlayerListener.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package me.taylorkelly.mywarp;

import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
Expand Down
27 changes: 15 additions & 12 deletions src/main/java/me/taylorkelly/mywarp/MyWarp.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.sql.Connection;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

import me.taylorkelly.mywarp.griefcraft.Updater;

Expand All @@ -28,7 +27,7 @@ public class MyWarp extends JavaPlugin {
public String name;
public String version;
private Updater updater;
public static final Logger log = Logger.getLogger("Minecraft");
public static final WarpLogger logger = WarpLogger.getLogger();

@Override
public void onDisable() {
Expand All @@ -47,7 +46,7 @@ public void onEnable() {

Connection conn = ConnectionManager.initialize();
if (conn == null) {
log.log(Level.SEVERE, "[MYWARP] Could not establish SQL connection. Disabling MyWarp");
logger.log(Level.SEVERE, "[MYWARP] Could not establish SQL connection. Disabling MyWarp");
getServer().getPluginManager().disablePlugin(this);
return;
}
Expand All @@ -67,7 +66,7 @@ public void onEnable() {
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_TELEPORT, playerListener, Priority.Monitor, this);
}

WarpLogger.info(name + " " + version + " enabled");
logger.info(name + " " + version + " enabled");
}


Expand All @@ -83,7 +82,7 @@ private void libCheck(){
private boolean sqlCheck() {
Connection conn = ConnectionManager.initialize();
if (conn == null) {
WarpLogger.severe("Could not establish SQL connection. Disabling MyWarp");
logger.severe("Could not establish SQL connection. Disabling MyWarp");
getServer().getPluginManager().disablePlugin(this);
return false;
}
Expand All @@ -100,7 +99,7 @@ private void updateFiles(File oldDatabase, File newDatabase) {
try {
newDatabase.createNewFile();
} catch (IOException ex) {
WarpLogger.severe("Could not create new database file", ex);
logger.severe("Could not create new database file", ex);
}
copyFile(oldDatabase, newDatabase);
}
Expand All @@ -123,7 +122,7 @@ private static void copyFile(File fromFile, File toFile) {
to.write(buffer, 0, bytesRead);
}
} catch (IOException ex) {
Logger.getLogger(MyWarp.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
} finally {
if (from != null) {
try {
Expand All @@ -140,15 +139,19 @@ private static void copyFile(File fromFile, File toFile) {
}
}

private boolean warning;

public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
String[] split = args;
String commandName = command.getName().toLowerCase();

String joinargs = "";
for (String part : args)
{
joinargs +=";"+part;
}
logger.info("Executed command: " + command.getName() + " with Args: " + joinargs);
if (sender instanceof Player) {
Player player = (Player) sender;
if (commandName.equals("warp") || commandName.equals("mywarp") || commandName.equals("mw")) {
if (commandName.equals("warp")) {
/**
* /warp reload
*/
Expand Down Expand Up @@ -451,11 +454,11 @@ public static boolean isInteger(String string) {
}

public static void severe(String string, Exception ex) {
log.log(Level.SEVERE, "[MYHOME]" + string, ex);
logger.log(Level.SEVERE, "[MYHOME]" + string, ex);

}

public static void severe(String string) {
log.log(Level.SEVERE, "[MYHOME]" + string);
logger.log(Level.SEVERE, "[MYHOME]" + string);
}
}
Loading