Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove some unused imports

  • Loading branch information...
commit 9bb05bd4e02c22559aab478d7dce0fa69f2c72de 1 parent 8a8b592
Exote authored
View
1  WebAuction/src/me/exote/webauction/WebAuction.java
@@ -8,7 +8,6 @@
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.ListIterator;
import java.util.logging.Logger;
import net.milkbowl.vault.economy.Economy;
View
32 WebAuction/src/me/exote/webauction/WebAuctionBlockListener.java
@@ -1,9 +1,7 @@
package me.exote.webauction;
-import java.net.MalformedURLException;
import java.sql.ResultSet;
-import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
@@ -15,10 +13,7 @@
public class WebAuctionBlockListener extends BlockListener{
- private final WebAuction plugin;
-
public WebAuctionBlockListener(final WebAuction plugin) {
- this.plugin = plugin;
}
@Override
public void onBlockBreak(BlockBreakEvent event){
@@ -27,7 +22,7 @@ public void onBlockBreak(BlockBreakEvent event){
if ((block.getTypeId() == 63)||(block.getTypeId() == 68)){
Sign thisSign = (Sign)block.getState();
if (thisSign.getLine(0).equals("[WebAuction]")){
- if (!plugin.permission.has(player, "wa.remove")){
+ if (!WebAuction.permission.has(player, "wa.remove")){
event.setCancelled(true);
player.sendMessage(WebAuction.logPrefix + "You do not have permission to remove that");
}else{
@@ -45,7 +40,7 @@ public void onSignChange(SignChangeEvent event){
if (player != null){
if (lines[0].equals("[WebAuction]")){
if (lines[1].equals("Shout")){
- if (plugin.permission.has(player, "wa.create.sign.shout")){
+ if (WebAuction.permission.has(player, "wa.create.sign.shout")){
allowEvent = true;
player.sendMessage(WebAuction.logPrefix + "Shout sign created.");
int radius = Integer.parseInt(lines[2]);
@@ -53,20 +48,18 @@ public void onSignChange(SignChangeEvent event){
WebAuction.shoutSigns.put(sign.getLocation(), radius);
String queryInsertRec = "INSERT INTO WA_ShoutSigns (world, radius, x, y, z) VALUES ('" + world.getName() +"', "+radius+", "+sign.getX()+", "+sign.getY()+", "+sign.getZ()+");";
try {
- plugin.manageMySQL.insertQuery(queryInsertRec);
+ WebAuction.manageMySQL.insertQuery(queryInsertRec);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if (lines[1].equals("Recent")){
- if (plugin.permission.has(player, "wa.create.sign.recent")){
+ if (WebAuction.permission.has(player, "wa.create.sign.recent")){
allowEvent = true;
player.sendMessage(WebAuction.logPrefix + "Recent auction sign created.");
int amount = 1;
@@ -80,7 +73,7 @@ public void onSignChange(SignChangeEvent event){
String recentQuery = "SELECT * FROM WA_Auctions ORDER BY id DESC;";
ResultSet result = null;
try{
- result = plugin.manageMySQL.sqlQuery(recentQuery);
+ result = WebAuction.manageMySQL.sqlQuery(recentQuery);
int counter = 0;
while (counter < amount)
{
@@ -95,16 +88,14 @@ public void onSignChange(SignChangeEvent event){
WebAuction.recentSigns.put(sign.getLocation(), amount);
String queryInsertRec = "INSERT INTO WA_RecentSigns (world, offset, x, y, z) VALUES ('" + world.getName() +"', "+amount+", "+sign.getX()+", "+sign.getY()+", "+sign.getZ()+");";
try {
- plugin.manageMySQL.insertQuery(queryInsertRec);
+ WebAuction.manageMySQL.insertQuery(queryInsertRec);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
event.setLine(1, stack.getType().toString());
event.setLine(2, quant+"");
event.setLine(3, ""+formattedPrice);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}else{
@@ -114,9 +105,8 @@ public void onSignChange(SignChangeEvent event){
event.setLine(3, "Not Available");
String queryInsertRec = "INSERT INTO WA_RecentSigns (world, offset, x, y, z) VALUES ('" + world.getName() +"', "+amount+", "+sign.getX()+", "+sign.getY()+", "+sign.getZ()+");";
try {
- plugin.manageMySQL.insertQuery(queryInsertRec);
+ WebAuction.manageMySQL.insertQuery(queryInsertRec);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -124,26 +114,26 @@ public void onSignChange(SignChangeEvent event){
}
}
if (lines[1].equals("Deposit")){
- if (plugin.permission.has(player, "wa.create.sign.deposit")){
+ if (WebAuction.permission.has(player, "wa.create.sign.deposit")){
allowEvent = true;
player.sendMessage(WebAuction.logPrefix + "Deposit point created");
}
}
if (lines[1].equals("Withdraw")){
- if (plugin.permission.has(player, "wa.create.sign.withdraw")){
+ if (WebAuction.permission.has(player, "wa.create.sign.withdraw")){
allowEvent = true;
player.sendMessage(WebAuction.logPrefix + "Withdraw point created");
}
}
if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].equals("Mail Box"))){
if (lines[2].equals("Deposit")){
- if (plugin.permission.has(player, "wa.create.sign.mailbox.deposit")){
+ if (WebAuction.permission.has(player, "wa.create.sign.mailbox.deposit")){
allowEvent = true;
player.sendMessage(WebAuction.logPrefix + "Deposit Mail Box created");
}
}else{
- if (plugin.permission.has(player, "wa.create.sign.mailbox.withdraw")){
+ if (WebAuction.permission.has(player, "wa.create.sign.mailbox.withdraw")){
allowEvent = true;
player.sendMessage(WebAuction.logPrefix + "Withdraw Mail Box created");
}
View
11 WebAuction/src/me/exote/webauction/WebAuctionCommands.java
@@ -1,22 +1,18 @@
package me.exote.webauction;
-import java.net.MalformedURLException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
-import java.util.List;
-import org.bukkit.Location;
-import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class WebAuctionCommands implements CommandExecutor{
- private final WebAuction plugin;
+
public WebAuctionCommands(final WebAuction plugin) {
- this.plugin = plugin;
+
}
public static String MD5(String str) {
MessageDigest md = null;
@@ -56,11 +52,10 @@ else if (params == 2){
String newPass = MD5(split[1]);
String queryUpdate = "UPDATE WA_Players SET pass='"+newPass+"' WHERE name='"+player.getName()+"';";
try {
- this.plugin.manageMySQL.updateQuery(queryUpdate);
+ WebAuction.manageMySQL.updateQuery(queryUpdate);
player.sendMessage(WebAuction.logPrefix + "Password changed");
return true;
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
return false;
View
70 WebAuction/src/me/exote/webauction/WebAuctionPlayerListener.java
@@ -1,25 +1,13 @@
package me.exote.webauction;
-import java.io.UnsupportedEncodingException;
+
import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.MalformedURLException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import java.sql.ResultSet;
-import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.Map;
-import net.milkbowl.vault.economy.Economy;
-
-import org.bukkit.Location;
-import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.enchantments.Enchantment;
@@ -32,11 +20,8 @@
public class WebAuctionPlayerListener extends PlayerListener{
-
- private final WebAuction plugin;
public WebAuctionPlayerListener(final WebAuction plugin) {
- this.plugin = plugin;
}
public static double round(double unrounded, int precision, int roundingMode)
{
@@ -49,16 +34,13 @@ public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
String playerName = player.getName();
WebAuction.playerTimer.put(player, WebAuction.getCurrentMilli());
- String queryPlayers = "SELECT * FROM WA_Players WHERE name= '"+playerName+"';";
String queryMail = "SELECT * FROM WA_Mail WHERE name= '"+playerName+"';";
String queryAlerts = "SELECT * FROM WA_SaleAlerts WHERE seller= '"+playerName+"' AND alerted= 'false';";
- ResultSet resultPlayers = null;
ResultSet resultMail = null;
ResultSet resultAlerts = null;
try {
- resultAlerts = this.plugin.manageMySQL.sqlQuery(queryAlerts);
+ resultAlerts = WebAuction.manageMySQL.sqlQuery(queryAlerts);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -70,19 +52,17 @@ public void onPlayerJoin(PlayerJoinEvent event) {
String item = resultAlerts.getString("item");
int quantity = resultAlerts.getInt("quantity");
Double priceEach = resultAlerts.getDouble("price");
- Double priceTotal = quantity+priceEach;
player.sendMessage(WebAuction.logPrefix + "You sold "+quantity+" "+item+" to "+buyer+" for "+priceEach+" each.");
String updateAlerts = "UPDATE WA_SaleAlerts SET alerted = '1' WHERE id = '"+id+"';";
- this.plugin.manageMySQL.updateQuery(updateAlerts);
+ WebAuction.manageMySQL.updateQuery(updateAlerts);
}
}
}catch (Exception e){
e.printStackTrace();
}
try {
- resultMail = this.plugin.manageMySQL.sqlQuery(queryMail);
+ resultMail = WebAuction.manageMySQL.sqlQuery(queryMail);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -97,9 +77,8 @@ public void onPlayerJoin(PlayerJoinEvent event) {
ResultSet result = null;
try {
- result = this.plugin.manageMySQL.sqlQuery(query);
+ result = WebAuction.manageMySQL.sqlQuery(query);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -107,34 +86,32 @@ public void onPlayerJoin(PlayerJoinEvent event) {
int canBuy = 0;
int canSell = 0;
int isAdmin = 0;
- if (plugin.permission.has(player, "wa.canbuy")){
+ if (WebAuction.permission.has(player, "wa.canbuy")){
canBuy = 1;
}
- if (plugin.permission.has(player, "wa.cansell")){
+ if (WebAuction.permission.has(player, "wa.cansell")){
canSell = 1;
}
- if (plugin.permission.has(player, "wa.webadmin")){
+ if (WebAuction.permission.has(player, "wa.webadmin")){
isAdmin = 1;
}
if ((result != null) && (result.next())){
String updatePermissions = "UPDATE WA_Players SET canBuy = '"+canBuy+"' WHERE name='"+playerName+"';";
- this.plugin.manageMySQL.updateQuery(updatePermissions);
+ WebAuction.manageMySQL.updateQuery(updatePermissions);
updatePermissions = "UPDATE WA_Players SET canSell = '"+canSell+"' WHERE name='"+playerName+"';";
- this.plugin.manageMySQL.updateQuery(updatePermissions);
+ WebAuction.manageMySQL.updateQuery(updatePermissions);
updatePermissions = "UPDATE WA_Players SET isAdmin = '"+isAdmin+"' WHERE name='"+playerName+"';";
- this.plugin.manageMySQL.updateQuery(updatePermissions);
+ WebAuction.manageMySQL.updateQuery(updatePermissions);
WebAuction.log.info(WebAuction.logPrefix + "Player found, canBuy: "+canBuy+" canSell: "+canSell+" isAdmin: "+isAdmin);
} else{
WebAuction.log.info(WebAuction.logPrefix + "Player not found, creating account");
//create that person in database
- String pass = WebAuctionCommands.MD5("Password");
String queryInsert = "INSERT INTO WA_Players (name, pass, money, canBuy, canSell, isAdmin) VALUES ('" + player.getName() +"', 'Password', " + 0 +", "+ canBuy +", "+ canSell +", "+ isAdmin +");";
try {
- this.plugin.manageMySQL.insertQuery(queryInsert);
+ WebAuction.manageMySQL.insertQuery(queryInsert);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -142,6 +119,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
e.printStackTrace();
}
}
+ @SuppressWarnings("deprecation")
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
@@ -150,7 +128,6 @@ public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
WebAuction.economy.getBalance(playerName);
if (block!=null){
- Location blockLoc = block.getLocation();
int blockMat = block.getTypeId();
if ((blockMat == 63)||(blockMat == 68)){
@@ -162,7 +139,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
if (WebAuction.playerTimer.get(player) < WebAuction.getCurrentMilli()){
WebAuction.playerTimer.put(player, WebAuction.getCurrentMilli()+ WebAuction.signDelay);
if (lines[1].equals("Deposit")){
- if (plugin.permission.has(player, "wa.use.deposit.money")){
+ if (WebAuction.permission.has(player, "wa.use.deposit.money")){
Double amount = 0.0;
if (!lines[2].equals("All")){
amount = Double.parseDouble(lines[2]);
@@ -194,7 +171,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
}
}
}else if (lines[1].equals("Withdraw")){
- if (plugin.permission.has(player, "wa.use.withdraw.money")){
+ if (WebAuction.permission.has(player, "wa.use.withdraw.money")){
Double amount = 0.0;
if (!lines[2].equals("All")){
amount = Double.parseDouble(lines[2]);
@@ -223,7 +200,6 @@ public void onPlayerInteract(PlayerInteractEvent event) {
player.sendMessage(WebAuction.logPrefix + "No WebAuction account found, try logging off and back on again");
}
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
} else {
@@ -272,7 +248,7 @@ else if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].e
enchTableId = result2.getInt("id");
} else {
String queryInsert = "INSERT INTO WA_Enchantments (enchName, enchId, level) VALUES ('" +enchName+"', '" +enchId+"', '"+level+"');";
- this.plugin.manageMySQL.insertQuery(queryInsert);
+ WebAuction.manageMySQL.insertQuery(queryInsert);
}
}
enchantmentIds.add(enchTableId);
@@ -294,7 +270,7 @@ else if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].e
currentQuantity += quantityInt;
String queryUpdate = "UPDATE WA_Items SET quantity='"+currentQuantity+"' WHERE id='"+itemTableIdNumber+"';";
//event.getPlayer().sendMessage(queryUpdate);
- this.plugin.manageMySQL.updateQuery(queryUpdate);
+ WebAuction.manageMySQL.updateQuery(queryUpdate);
foundMatch = true;
}else
if ((enchantmentIds.isEmpty())&&(enchantmentIdsStoredTemp.isEmpty())){
@@ -303,7 +279,7 @@ else if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].e
currentQuantity += quantityInt;
String queryUpdate = "UPDATE WA_Items SET quantity='"+currentQuantity+"' WHERE id='"+itemTableIdNumber+"';";
//event.getPlayer().sendMessage(queryUpdate);
- this.plugin.manageMySQL.updateQuery(queryUpdate);
+ WebAuction.manageMySQL.updateQuery(queryUpdate);
foundMatch = true;
}
@@ -312,7 +288,7 @@ else if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].e
String queryInsert = "INSERT INTO WA_Items (name, damage, player, quantity) VALUES ('" +itemName+"', '" +itemDamage+"', '"+playerName+"', '"+quantityInt+"');";
//event.getPlayer().sendMessage(queryInsert);
- this.plugin.manageMySQL.insertQuery(queryInsert);
+ WebAuction.manageMySQL.insertQuery(queryInsert);
querySelect = "SELECT * FROM WA_Items WHERE player='"+playerName+"' AND name='"+itemName+"' AND damage='"+itemDamage+"' ORDER BY id DESC;";
result = null;
int itemTableId = -1;
@@ -337,24 +313,23 @@ else if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].e
enchTableId = result.getInt("id");
} else {
queryInsert = "INSERT INTO WA_Enchantments (enchName, enchId, level) VALUES ('" +enchName+"', '" +enchId+"', '"+level+"');";
- this.plugin.manageMySQL.insertQuery(queryInsert);
+ WebAuction.manageMySQL.insertQuery(queryInsert);
}
}
queryInsert = "INSERT INTO WA_EnchantLinks (enchId, itemTableId, itemId) VALUES ('" +enchTableId+"', '0', '"+itemTableId+"');";
- this.plugin.manageMySQL.insertQuery(queryInsert);
+ WebAuction.manageMySQL.insertQuery(queryInsert);
}
}
player.sendMessage(WebAuction.logPrefix + "Item stack stored.");
}
}
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
player.setItemInHand(null);
}else{
- if (plugin.permission.has(player, "wa.use.withdraw.items")){
+ if (WebAuction.permission.has(player, "wa.use.withdraw.items")){
try {
String query = "SELECT * FROM WA_Mail WHERE player = '"+playerName+"'";
@@ -427,7 +402,6 @@ else if ((lines[1].equals("MailBox"))||(lines[1].equals("Mailbox"))||(lines[1].e
player.sendMessage(WebAuction.logPrefix + "No mail");
}
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.