mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 12:38:40 +01:00
- Added support for OddItem 0.8
- Fixed getRetractBlock
This commit is contained in:
parent
06e02cbc3e
commit
4440101a3a
@ -4,6 +4,7 @@ import com.Acrobot.ChestShop.ChestShop;
|
|||||||
import com.Acrobot.ChestShop.Config.Config;
|
import com.Acrobot.ChestShop.Config.Config;
|
||||||
import com.Acrobot.ChestShop.Config.Property;
|
import com.Acrobot.ChestShop.Config.Property;
|
||||||
|
|
||||||
|
import javax.persistence.OptimisticLockException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +20,8 @@ public class Queue implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
ChestShop.getDB().delete(ChestShop.getDB().find(Transaction.class).where().lt("sec", System.currentTimeMillis() / 1000 - Config.getInteger(Property.RECORD_TIME_TO_LIVE)).findList());
|
ChestShop.getDB().delete(ChestShop.getDB().find(Transaction.class).where().lt("sec", System.currentTimeMillis() / 1000 - Config.getInteger(Property.RECORD_TIME_TO_LIVE)).findList());
|
||||||
|
|
||||||
ChestShop.getDB().save(queue);
|
ArrayList<Transaction> queueCopy = queue;
|
||||||
|
try { ChestShop.getDB().save(queueCopy); } catch (OptimisticLockException ignored) {}
|
||||||
queue.clear();
|
queue.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
* @author Acrobot
|
* @author Acrobot
|
||||||
*/
|
*/
|
||||||
public class Odd {
|
public class Odd {
|
||||||
public static OddItem oddItem;
|
public static boolean isInitialized;
|
||||||
|
|
||||||
public static boolean isInitialized() {
|
public static boolean isInitialized() {
|
||||||
return oddItem != null;
|
return isInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack returnItemStack(String name) {
|
public static ItemStack returnItemStack(String name) {
|
||||||
try {
|
try {
|
||||||
return oddItem.getItemStack(name);
|
return OddItem.getItemStack(name);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.material.PistonBaseMaterial;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Acrobot
|
* @author Acrobot
|
||||||
@ -58,6 +57,6 @@ public class blockBreak extends BlockListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Block getRetractBlock(BlockPistonRetractEvent event) {
|
private static Block getRetractBlock(BlockPistonRetractEvent event) {
|
||||||
return event.getBlock().getState().getData() instanceof PistonBaseMaterial ? event.getRetractLocation().getBlock() : null;
|
return (!uSign.isSign(event.getRetractLocation().getBlock()) ? event.getRetractLocation().getBlock() : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import com.Acrobot.ChestShop.Utils.uLongName;
|
|||||||
import com.Acrobot.ChestShop.Utils.uSign;
|
import com.Acrobot.ChestShop.Utils.uSign;
|
||||||
import net.minecraft.server.IInventory;
|
import net.minecraft.server.IInventory;
|
||||||
import net.minecraft.server.InventoryLargeChest;
|
import net.minecraft.server.InventoryLargeChest;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
|
@ -10,13 +10,11 @@ import com.Acrobot.ChestShop.Protection.Plugins.LockettePlugin;
|
|||||||
import com.Acrobot.ChestShop.Protection.Security;
|
import com.Acrobot.ChestShop.Protection.Security;
|
||||||
import com.Acrobot.ChestShop.Utils.uNumber;
|
import com.Acrobot.ChestShop.Utils.uNumber;
|
||||||
import com.Acrobot.ChestShop.Utils.uSign;
|
import com.Acrobot.ChestShop.Utils.uSign;
|
||||||
import com.Acrobot.ChestShop.Utils.uTowny;
|
|
||||||
import com.daemitus.deadbolt.Deadbolt;
|
import com.daemitus.deadbolt.Deadbolt;
|
||||||
import com.griefcraft.lwc.LWCPlugin;
|
import com.griefcraft.lwc.LWCPlugin;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.nijikokun.register.payment.forChestShop.Methods;
|
import com.nijikokun.register.payment.forChestShop.Methods;
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
import info.somethingodd.bukkit.OddItem.OddItem;
|
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
import org.bukkit.event.server.ServerListener;
|
import org.bukkit.event.server.ServerListener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -59,17 +57,22 @@ public class pluginEnable extends ServerListener {
|
|||||||
DeadboltPlugin.deadbolt = (Deadbolt) plugin;
|
DeadboltPlugin.deadbolt = (Deadbolt) plugin;
|
||||||
Security.protection = new DeadboltPlugin();
|
Security.protection = new DeadboltPlugin();
|
||||||
} else if (name.equals("OddItem")) {
|
} else if (name.equals("OddItem")) {
|
||||||
if (Odd.oddItem != null) return;
|
if (Odd.isInitialized()) return;
|
||||||
Odd.oddItem = (OddItem) plugin;
|
if (plugin.getDescription().getVersion().startsWith("0.7")) { System.out.println(generateOutdatedVersion(name, plugin.getDescription().getVersion(), "0.8")); return; }
|
||||||
|
Odd.isInitialized = true;
|
||||||
} else if (name.equals("Towny")) {
|
} else if (name.equals("Towny")) {
|
||||||
if (uSign.towny != null) return;
|
if (uSign.towny != null) return;
|
||||||
int versionNumber = 0;
|
int versionNumber = 0;
|
||||||
String[] split = plugin.getDescription().getVersion().split("\\.");
|
String[] split = plugin.getDescription().getVersion().split("\\.");
|
||||||
for (int i = 0; i < 4; i++) if (split.length >= i + 1 && uNumber.isInteger(split[i])) versionNumber += (Math.pow(10, (3 - i) << 1) * Integer.parseInt(split[i])); //EPIC CODE RIGHT HERE
|
for (int i = 0; i < 4; i++) if (split.length >= i + 1 && uNumber.isInteger(split[i])) versionNumber += (Math.pow(10, (3 - i) << 1) * Integer.parseInt(split[i])); //EPIC CODE RIGHT HERE
|
||||||
if(versionNumber < 760047){ System.out.println(ChestShop.chatPrefix + "Your Towny version is outdated! Need version AT LEAST 0.76.0.47! - Your version is " + plugin.getDescription().getVersion()); return; }
|
if (versionNumber < 760047) { System.out.println(generateOutdatedVersion(name, plugin.getDescription().getVersion(), "0.76.0.47")); return; }
|
||||||
uSign.towny = (Towny) plugin;
|
uSign.towny = (Towny) plugin;
|
||||||
}
|
}
|
||||||
PluginDescriptionFile description = plugin.getDescription();
|
PluginDescriptionFile description = plugin.getDescription();
|
||||||
System.out.println(ChestShop.chatPrefix + description.getName() + " version " + description.getVersion() + " loaded.");
|
System.out.println(ChestShop.chatPrefix + description.getName() + " version " + description.getVersion() + " loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String generateOutdatedVersion(String pluginName, String curVersion, String neededVersion){
|
||||||
|
return (new StringBuilder(7).append(ChestShop.chatPrefix).append("Your ").append(pluginName).append(" is outdated! Need version AT LEAST ").append(neededVersion).append(" - Your version is ").append(curVersion).toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ name: ChestShop
|
|||||||
|
|
||||||
main: com.Acrobot.ChestShop.ChestShop
|
main: com.Acrobot.ChestShop.ChestShop
|
||||||
|
|
||||||
version: 3.2
|
version: 3.21
|
||||||
|
|
||||||
|
|
||||||
author: Acrobot
|
author: Acrobot
|
||||||
|
Loading…
Reference in New Issue
Block a user