mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2025-02-16 01:42:18 +01:00
Remove 1.12.2 & below support!
This commit is contained in:
parent
fd9c396483
commit
f468716aff
@ -1,6 +1,5 @@
|
||||
package com.badbones69.crazyauctions;
|
||||
|
||||
import com.badbones69.crazyauctions.api.CrazyManager;
|
||||
import com.badbones69.crazyauctions.api.FileManager.Files;
|
||||
import com.badbones69.crazyauctions.api.enums.Messages;
|
||||
import com.badbones69.crazyauctions.utils.ItemBuilder;
|
||||
@ -19,15 +18,13 @@ import java.util.regex.Pattern;
|
||||
public class Methods {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
private final CrazyManager crazyManager = plugin.getStarter().getCrazyManager();
|
||||
|
||||
public final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");
|
||||
|
||||
public String color(String message) {
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_15_R1)) {
|
||||
Matcher matcher = HEX_PATTERN.matcher(message);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buffer, net.md_5.bungee.api.ChatColor.of(matcher.group()).toString());
|
||||
@ -65,19 +62,11 @@ public class Methods {
|
||||
}
|
||||
|
||||
public ItemStack getItemInHand(Player player) {
|
||||
if (ServerProtocol.isAtLeast(ServerProtocol.v1_12_R1)) {
|
||||
return player.getInventory().getItemInMainHand();
|
||||
} else {
|
||||
return player.getItemInHand();
|
||||
}
|
||||
return player.getInventory().getItemInMainHand();
|
||||
}
|
||||
|
||||
public void setItemInHand(Player player, ItemStack item) {
|
||||
if (ServerProtocol.isAtLeast(ServerProtocol.v1_12_R1)) {
|
||||
player.getInventory().setItemInMainHand(item);
|
||||
} else {
|
||||
player.setItemInHand(item);
|
||||
}
|
||||
player.getInventory().setItemInMainHand(item);
|
||||
}
|
||||
|
||||
public Player getPlayer(String name) {
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.badbones69.crazyauctions.api;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import com.badbones69.crazyauctions.utils.func.ServerProtocol;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -46,17 +44,6 @@ public class FileManager {
|
||||
|
||||
if (!newFile.exists()) {
|
||||
try {
|
||||
String fileLocation = file.getFileLocation();
|
||||
|
||||
// Switch between 1.12.2- and 1.13+ config version.
|
||||
if (file == Files.CONFIG) {
|
||||
if (ServerProtocol.isOlder(ServerProtocol.v1_13_R2)) {
|
||||
fileLocation = "config1.12.2-Down.yml";
|
||||
} else {
|
||||
fileLocation = "config1.13-Up.yml";
|
||||
}
|
||||
}
|
||||
|
||||
File serverFile = new File(plugin.getDataFolder(), "/" + file.getFileLocation());
|
||||
InputStream jarFile = getClass().getResourceAsStream("/" + file.getFileJar());
|
||||
copyFile(jarFile, serverFile);
|
||||
|
@ -41,17 +41,10 @@ public enum AuctionCategories {
|
||||
private static ArrayList<Material> getArmor() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_12_R1)) {
|
||||
ma.add(Material.matchMaterial("GOLDEN_HELMET"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_CHESTPLATE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_LEGGINGS"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_BOOTS"));
|
||||
} else {
|
||||
ma.add(Material.matchMaterial("GOLD_HELMET"));
|
||||
ma.add(Material.matchMaterial("GOLD_CHESTPLATE"));
|
||||
ma.add(Material.matchMaterial("GOLD_LEGGINGS"));
|
||||
ma.add(Material.matchMaterial("GOLD_BOOTS"));
|
||||
}
|
||||
ma.add(Material.matchMaterial("GOLDEN_HELMET"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_CHESTPLATE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_LEGGINGS"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_BOOTS"));
|
||||
|
||||
ma.add(Material.DIAMOND_HELMET);
|
||||
ma.add(Material.DIAMOND_CHESTPLATE);
|
||||
@ -83,31 +76,17 @@ public enum AuctionCategories {
|
||||
private static ArrayList<Material> getTools() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_12_R1)) {
|
||||
ma.add(Material.matchMaterial("WOODEN_PICKAXE"));
|
||||
ma.add(Material.matchMaterial("WOODEN_AXE"));
|
||||
ma.add(Material.matchMaterial("WOODEN_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("WOODEN_HOE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_PICKAXE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_AXE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_HOE"));
|
||||
ma.add(Material.matchMaterial("STONE_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("IRON_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("DIAMOND_SHOVEL"));
|
||||
} else {
|
||||
ma.add(Material.matchMaterial("WOOD_PICKAXE"));
|
||||
ma.add(Material.matchMaterial("WOOD_AXE"));
|
||||
ma.add(Material.matchMaterial("WOOD_SPADE"));
|
||||
ma.add(Material.matchMaterial("WOOD_HOE"));
|
||||
ma.add(Material.matchMaterial("GOLD_PICKAXE"));
|
||||
ma.add(Material.matchMaterial("GOLD_AXE"));
|
||||
ma.add(Material.matchMaterial("GOLD_SPADE"));
|
||||
ma.add(Material.matchMaterial("GOLD_HOE"));
|
||||
ma.add(Material.matchMaterial("STONE_SPADE"));
|
||||
ma.add(Material.matchMaterial("IRON_SPADE"));
|
||||
ma.add(Material.matchMaterial("DIAMOND_SPADE"));
|
||||
}
|
||||
ma.add(Material.matchMaterial("WOODEN_PICKAXE"));
|
||||
ma.add(Material.matchMaterial("WOODEN_AXE"));
|
||||
ma.add(Material.matchMaterial("WOODEN_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("WOODEN_HOE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_PICKAXE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_AXE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_HOE"));
|
||||
ma.add(Material.matchMaterial("STONE_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("IRON_SHOVEL"));
|
||||
ma.add(Material.matchMaterial("DIAMOND_SHOVEL"));
|
||||
|
||||
ma.add(Material.STONE_PICKAXE);
|
||||
ma.add(Material.IRON_PICKAXE);
|
||||
@ -132,17 +111,10 @@ public enum AuctionCategories {
|
||||
private static ArrayList<Material> getWeapons() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_12_R1)) {
|
||||
ma.add(Material.matchMaterial("WOODEN_SWORD"));
|
||||
ma.add(Material.matchMaterial("WOODEN_AXE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_SWORD"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_AXE"));
|
||||
} else {
|
||||
ma.add(Material.matchMaterial("WOOD_SWORD"));
|
||||
ma.add(Material.matchMaterial("WOOD_AXE"));
|
||||
ma.add(Material.matchMaterial("GOLD_SWORD"));
|
||||
ma.add(Material.matchMaterial("GOLD_AXE"));
|
||||
}
|
||||
ma.add(Material.matchMaterial("WOODEN_SWORD"));
|
||||
ma.add(Material.matchMaterial("WOODEN_AXE"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_SWORD"));
|
||||
ma.add(Material.matchMaterial("GOLDEN_AXE"));
|
||||
|
||||
ma.add(Material.STONE_SWORD);
|
||||
ma.add(Material.IRON_SWORD);
|
||||
@ -185,17 +157,21 @@ public enum AuctionCategories {
|
||||
|
||||
private static ArrayList<Material> getBlocks() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
for (Material m : Material.values()) {
|
||||
if (m.isBlock()) ma.add(m);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getOthers() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
for (Material m : Material.values()) {
|
||||
if (!(getArmor().contains(m) || getTools().contains(m) || getWeapons().contains(m) || getFood().contains(m) || getPotions().contains(m) || getBlocks().contains(m))) ma.add(m);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
|
@ -1,304 +0,0 @@
|
||||
Settings:
|
||||
Prefix: '&7[&4Crazy &bAuctions&7]: ' #Prefix of when you get Crazy Auctions Messages.
|
||||
GUIName: '&4Crazy &bAuctions&8' #Name of the Main GUI.
|
||||
Players-Current-Items: '&8Your Current Listings' #The Name of the Player Current Items GUI.
|
||||
Cancelled/Expired-Items: '&8Cancelled/Expired Listings' #Name of the Canceled/Expired GUI.
|
||||
Buying-Item: '&8Purchase Item: Are You Sure?' #Name of the Buying GUI.
|
||||
Bidding-On-Item: '&8You Are Bidding On This Item.' #Name of the Bidding GUI.
|
||||
Categories: '&8Categories' #Name of the Category GUI.
|
||||
Sell-Time: 2d #The time that each item will sell for.
|
||||
Bid-Time: 2m 30s #Time for each item that is biddable.
|
||||
Full-Expire-Time: 10d #The full time the item is in the crazy auctions.
|
||||
Bid-Winner-Time: 20d #The time the winner of a bid has to claim their prize.
|
||||
Minimum-Sell-Price: 10 #Minimum amount you can sell an item for.
|
||||
Max-Beginning-Sell-Price: 1000000 #Max amount you can sell an item for.
|
||||
Minimum-Bid-Price: 100 #Minimum starting bid.
|
||||
Max-Beginning-Bid-Price: 1000000 #Maximum starting bid.
|
||||
Allow-Damaged-Items: False #Allow items that have been damaged.
|
||||
Category-Page-Opens-First: False #If set to true the categories' page will open when they do /CA.
|
||||
Feature-Toggle: #Toggle if a feature is on or off.
|
||||
Selling: true #Able to use the selling part of the auction house.
|
||||
Bidding: true #Able to use the bidding part of the auction house.
|
||||
Sounds:
|
||||
Toggle: False #Disable the clicking sound.
|
||||
Sound: 'CLICK' #Make sure if you use 1.8 or lower you use the 1.8 sound and 1.9 and up use 1.9 sounds. The default sound is 1.8.
|
||||
#1.8 sounds are found here: http://badbones69.com/javadocs/1.8.8/org/bukkit/Sound.html
|
||||
#1.9 sounds are found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
|
||||
GUISettings: #Settings for things in the gui.
|
||||
SellingItemLore: #The lore on items that are being sold.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to purchase.'
|
||||
- ''
|
||||
- '&9Price: &e$%price%'
|
||||
- '&9Seller: &e%seller%'
|
||||
- '&7-------------------------'
|
||||
CurrentLore: #Lore on items that are in your current items GUI.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to cancel.'
|
||||
- ''
|
||||
- '&9Price: &e$%price%'
|
||||
- '&9Expire: &e%time%'
|
||||
- '&7-------------------------'
|
||||
Cancelled/ExpiredLore: #Lore on items that are in your canceled/expired GUI.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to return to you.'
|
||||
- ''
|
||||
- '&9Full Expire: &e%time%'
|
||||
- '&7-------------------------'
|
||||
Bidding: #Lore on Bidding Items.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to bid.'
|
||||
- ''
|
||||
- '&9Seller: &e%seller%'
|
||||
- '&9Current Bid: &e$%topbid%'
|
||||
- '&9Top Bidder: &e%topbidder%'
|
||||
- '&9Time Left: &e%time%'
|
||||
- '&7-------------------------'
|
||||
Category-Settings:
|
||||
Armor:
|
||||
Item: '315'
|
||||
Toggle: true
|
||||
Slot: 11
|
||||
Name: '&6&lArmor'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7armor that is currently being sold.'
|
||||
Weapons:
|
||||
Item: '283'
|
||||
Toggle: true
|
||||
Slot: 12
|
||||
Name: '&6&lWeapons'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7weapons that are currently being sold.'
|
||||
Tools:
|
||||
Item: '285'
|
||||
Toggle: true
|
||||
Slot: 13
|
||||
Name: '&6&lTools'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7tools that are currently being sold.'
|
||||
Food:
|
||||
Item: '322'
|
||||
Toggle: true
|
||||
Slot: 14
|
||||
Name: '&6&lFood'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7food that is currently being sold.'
|
||||
Potions:
|
||||
Item: '373:8227'
|
||||
Toggle: true
|
||||
Slot: 15
|
||||
Name: '&6&lPotions'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7potions that are currently being sold.'
|
||||
Blocks:
|
||||
Item: '2'
|
||||
Toggle: true
|
||||
Slot: 16
|
||||
Name: '&6&lBlocks'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7blocks that are currently being sold.'
|
||||
Other:
|
||||
Item: '371'
|
||||
Toggle: true
|
||||
Slot: 17
|
||||
Name: '&6&lOthers'
|
||||
Lore:
|
||||
- '&7This category contains all the'
|
||||
- '&7other items currently being sold.'
|
||||
None:
|
||||
Item: '166'
|
||||
Toggle: true
|
||||
Slot: 23
|
||||
Name: '&6&lNone'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7items currently being sold.'
|
||||
OtherSettings: #Other Settings for the GUIs.
|
||||
SellingItems: #The button for your current items.
|
||||
Item: '264' #The item that this button is.
|
||||
Toggle: true #If the item is in the gui or not.
|
||||
Slot: 46 #The slot it is in. I recommend not changing these. If you do make sure they are still in the bottom row.
|
||||
Name: '&6Items You are Selling' #Name of the item.
|
||||
Lore: #Lore of the item.
|
||||
- '&aClick here to view all the items you'
|
||||
- '&aare currently selling on the auction.'
|
||||
Cancelled/ExpiredItems: #The button for Canceled/Expired Items.
|
||||
Item: '394'
|
||||
Toggle: true
|
||||
Slot: 47
|
||||
Name: '&6Collect Expired / Canceled Items'
|
||||
Lore:
|
||||
- '&aClick here to view and collect all of the'
|
||||
- '&aitems you have canceled or has expired.'
|
||||
PreviousPage: #The button for Previous Page.
|
||||
Item: '339'
|
||||
Toggle: true
|
||||
Slot: 49
|
||||
Name: '&6Previous Page'
|
||||
Lore: { }
|
||||
Refesh: #The button for Refresh Page.
|
||||
Item: '175'
|
||||
Toggle: true
|
||||
Slot: 50
|
||||
Name: '&6Refresh Page'
|
||||
Lore: { }
|
||||
NextPage: #The button for Next Page.
|
||||
Item: '339'
|
||||
Toggle: true
|
||||
Slot: 51
|
||||
Name: '&6Next Page'
|
||||
Lore: { }
|
||||
Category1: #The button for Next Page.
|
||||
Item: '54'
|
||||
Toggle: true
|
||||
Slot: 52
|
||||
Name: '&6Categories'
|
||||
Lore:
|
||||
- '&bCurrent Category: &6%category%'
|
||||
- '&aWant to see items in specific categories?'
|
||||
- '&aClick here to see all categories of items.'
|
||||
Category2: #The button for Next Page.
|
||||
Item: '54'
|
||||
Toggle: true
|
||||
Slot: 48
|
||||
Name: '&6Categories'
|
||||
Lore:
|
||||
- '&bCurrent Category: &6%category%'
|
||||
- '&aWant to see items in specific categories?'
|
||||
- '&aClick here to see all categories of items.'
|
||||
Bidding/Selling: #Switch between Bidding and Selling.
|
||||
Selling:
|
||||
Item: '341'
|
||||
Toggle: true
|
||||
Slot: 53
|
||||
Name: '&6Currently looking at items being sold.'
|
||||
Lore:
|
||||
- '&7&l(&6&l!&7&l) &7Click here to see items'
|
||||
- '&7that you can bid on.'
|
||||
Bidding:
|
||||
Item: '378'
|
||||
Toggle: true
|
||||
Slot: 53
|
||||
Name: '&6Currently looking at items that can be bid on.'
|
||||
Lore:
|
||||
- '&7&l(&6&l!&7&l) &7Click here to see items'
|
||||
- '&7that you can buy at a price.'
|
||||
WhatIsThis: #The info on all the Books buttons.
|
||||
SellingShop: #The Book in the main shop.
|
||||
Item: '340'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis is the crazy auctions, here you can'
|
||||
- '&aput items for sale, and buy items'
|
||||
- '&athat others have put for sale.'
|
||||
- ''
|
||||
- '&aThe auction is also a great place to make'
|
||||
- '&amoney by selling items that others'
|
||||
- '&amay be interested in buying.'
|
||||
BiddingShop: #The Book in the main shop.
|
||||
Item: '340'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis is the crazy auctions, here you can'
|
||||
- '&aput items for sale, and bid on items'
|
||||
- '&athat others have put for sale.'
|
||||
- ''
|
||||
- '&aThe bidding auction is also a great place to'
|
||||
- '&amake money by bidding off items that others'
|
||||
- '&amay be interested in bidding on.'
|
||||
CurrentItems: #The Book in the Current items GUI.
|
||||
Item: '340'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThese are your current listings, all of'
|
||||
- '&athe items you currenty have listed on'
|
||||
- '&acrazy auctions are displayed here.'
|
||||
- ''
|
||||
- '&aYou can cancel and view your listings'
|
||||
- '&aexpire time here.'
|
||||
Cancelled/ExpiredItems: #The Book in the Canceled/Expired Items GUI.
|
||||
Item: '340'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis page houses all of your cancelled and'
|
||||
- '&aexpired items, when a listings is cancelled'
|
||||
- '&aor expires you will be able to return that'
|
||||
- '&aitem back to you from this menu.'
|
||||
- ''
|
||||
- '&aJust click on the item and if you have enough'
|
||||
- '&ainventory space you will receive that item.'
|
||||
Viewing: #The Book in the Viewing Items GUI.
|
||||
Item: '340'
|
||||
Toggle: true
|
||||
Slot: 50
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis page shows all the items that'
|
||||
- '&aa player has currently on the bidding'
|
||||
- '&aand selling market. You can quickly see'
|
||||
- '&awhat a specific player is selling.'
|
||||
Categories: #The Book in the Viewing Items GUI.
|
||||
Item: '340'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis page shows all the categories'
|
||||
- '&athat you can choose from. When you click'
|
||||
- '&aa category it will open the gui with only'
|
||||
- '&aitems that belong to that category.'
|
||||
Back: #The Back Buttons.
|
||||
Item: '339'
|
||||
Slot: 46
|
||||
Name: '&6Back'
|
||||
Return: #The Return Buttons.
|
||||
Item: '390'
|
||||
Slot: 50
|
||||
Name: '&6Return All'
|
||||
Lore:
|
||||
- '&aClick here to return all cancelled'
|
||||
- '&aand expired items to your inventory.'
|
||||
Confirm: #The Confirm Buttons.
|
||||
Item: '160:5'
|
||||
Name: '&aConfirm'
|
||||
Cancel: #The Cancel Buttons.
|
||||
Item: '160:14'
|
||||
Name: '&cCancel'
|
||||
Your-Item: #The item that shows when you try to buy/bid on your item.
|
||||
Item: '166'
|
||||
Name: '&cYou Can''t Purchase Your Own Item.'
|
||||
Cant-Afford: #The item that shows when you can't afford this item.
|
||||
Item: '166'
|
||||
Name: '&cYou Can''t Afford This Item.'
|
||||
Top-Bidder: #The item for when a player is already the top bidder.
|
||||
Item: '166'
|
||||
Name: '&cYou are already the top bidder.'
|
||||
Bidding: #The item in the middle when bidding on an item.
|
||||
Item: '160:15'
|
||||
Name: '&7Bidding'
|
||||
Lore:
|
||||
- '&7<--&aAdd &cRemove&7-->'
|
||||
- '&9Your Current Bid: &e$%bid%'
|
||||
- '&9Current Top Bid: &e$%topbid%'
|
||||
Bid: #The button for when you want to confirm your bid.
|
||||
Item: '160:3'
|
||||
Name: '&bBid Now'
|
||||
Lore:
|
||||
- '&7Click here to Bid Now.'
|
||||
BlackList:
|
||||
- '7'
|
||||
- '120'
|
Loading…
Reference in New Issue
Block a user