Skip to content

Commit

Permalink
Added 1.13 support, renamed packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
biscuut committed Nov 28, 2018
1 parent 76adcb4 commit a397426
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 74 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>xyz.biscut.chunkbuster</groupId>
<groupId>codes.biscuit</groupId>
<artifactId>ChunkBuster</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
<name>ChunkBuster</name>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package xyz.biscut.chunkbuster;
package codes.biscuit.chunkbuster;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import xyz.biscut.chunkbuster.commands.ChunkBusterCommand;
import xyz.biscut.chunkbuster.events.OtherEvents;
import xyz.biscut.chunkbuster.events.PlayerEvents;
import xyz.biscut.chunkbuster.utils.HookType;
import xyz.biscut.chunkbuster.utils.HookUtils;
import xyz.biscut.chunkbuster.utils.ConfigValues;
import xyz.biscut.chunkbuster.utils.Utils;
import codes.biscuit.chunkbuster.commands.ChunkBusterCommand;
import codes.biscuit.chunkbuster.events.OtherEvents;
import codes.biscuit.chunkbuster.events.PlayerEvents;
import codes.biscuit.chunkbuster.utils.HookType;
import codes.biscuit.chunkbuster.utils.HookUtils;
import codes.biscuit.chunkbuster.utils.ConfigValues;
import codes.biscuit.chunkbuster.utils.Utils;

public class ChunkBuster extends JavaPlugin {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.commands;
package codes.biscuit.chunkbuster.commands;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
Expand All @@ -9,7 +9,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.biscut.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.ChunkBuster;

import java.util.*;

Expand Down
35 changes: 35 additions & 0 deletions src/main/java/codes/biscuit/chunkbuster/events/OtherEvents.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package codes.biscuit.chunkbuster.events;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFromToEvent;
import codes.biscuit.chunkbuster.ChunkBuster;

public class OtherEvents implements Listener {

private ChunkBuster main;

public OtherEvents(ChunkBuster main) {
this.main = main;
}

@EventHandler
public void onWaterFlow(BlockFromToEvent e) {
if (Bukkit.getVersion().contains("1.13")) {
if (e.getBlock().getType().equals(Material.WATER) || e.getBlock().getType().equals(Material.LAVA)) {
if (!main.getUtils().getWaterChunks().contains(e.getBlock().getChunk()) && main.getUtils().getWaterChunks().contains(e.getToBlock().getChunk())) {
e.setCancelled(true);
}
}
} else {
if (e.getBlock().getType().equals(Material.WATER) || e.getBlock().getType().equals(Material.valueOf("STATIONARY_WATER"))
|| e.getBlock().getType().equals(Material.LAVA) || e.getBlock().getType().equals(Material.valueOf("STATIONARY_LAVA"))) {
if (!main.getUtils().getWaterChunks().contains(e.getBlock().getChunk()) && main.getUtils().getWaterChunks().contains(e.getToBlock().getChunk())) {
e.setCancelled(true);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.events;
package codes.biscuit.chunkbuster.events;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.*;
Expand All @@ -13,10 +13,10 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.biscut.chunkbuster.ChunkBuster;
import xyz.biscut.chunkbuster.timers.MessageTimer;
import xyz.biscut.chunkbuster.timers.SoundTimer;
import xyz.biscut.chunkbuster.utils.HookType;
import codes.biscuit.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.timers.MessageTimer;
import codes.biscuit.chunkbuster.timers.SoundTimer;
import codes.biscuit.chunkbuster.utils.HookType;

import java.util.HashMap;

Expand Down Expand Up @@ -136,7 +136,7 @@ public void onChunkBusterPlace(BlockPlaceEvent e) {
@EventHandler
public void onConfirmClick(InventoryClickEvent e) {
if (e.getClickedInventory() != null && e.getClickedInventory().getName() != null &&
e.getClickedInventory().getName().contains(main.getConfigValues().getGUITitle())) {
e.getClickedInventory().getName().equals(main.getConfigValues().getGUITitle())) {
e.setCancelled(true);
Player p = (Player)e.getWhoClicked();
Location chunkBusterLocation = chunkBusterLocations.get(e.getWhoClicked());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.hooks;
package codes.biscuit.chunkbuster.hooks;


import com.massivecraft.factions.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.hooks;
package codes.biscuit.chunkbuster.hooks;

import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.BoardColl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.hooks;
package codes.biscuit.chunkbuster.hooks;

import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.RegionContainer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xyz.biscut.chunkbuster.timers;
package codes.biscuit.chunkbuster.timers;

import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import xyz.biscut.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.ChunkBuster;

public class MessageTimer extends BukkitRunnable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package xyz.biscut.chunkbuster.timers;
package codes.biscuit.chunkbuster.timers;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.scheduler.BukkitRunnable;
import xyz.biscut.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.ChunkBuster;

import java.util.LinkedList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xyz.biscut.chunkbuster.timers;
package codes.biscuit.chunkbuster.timers;

import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import xyz.biscut.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.ChunkBuster;

public class SoundTimer extends BukkitRunnable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package xyz.biscut.chunkbuster.utils;
package codes.biscuit.chunkbuster.utils;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import xyz.biscut.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.ChunkBuster;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -26,14 +26,14 @@ public Material getChunkBusterMaterial() {
try {
mat = Material.valueOf(materialSplit[0]);
} catch (IllegalArgumentException ex) {
mat = Material.ENDER_PORTAL_FRAME;
mat = getEnderPortalMaterial();
Bukkit.getLogger().severe("Your chunk buster material is invalid!");
}
} else {
try {
mat = Material.valueOf(rawMaterial);
} catch (IllegalArgumentException ex) {
mat = Material.ENDER_PORTAL_FRAME;
mat = getEnderPortalMaterial();
Bukkit.getLogger().severe("Your chunk buster material is invalid!");
}
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public ItemStack getConfirmBlockItemStack() {
try {
mat = Material.valueOf(materialSplit[0]);
} catch (IllegalArgumentException ex) {
mat = Material.WOOL;
mat = getDefaultConfirmMaterial();
Bukkit.getLogger().severe("Your accept-block material is invalid!");
}
short damage;
Expand All @@ -103,7 +103,7 @@ public ItemStack getConfirmBlockItemStack() {
try {
mat = Material.valueOf(rawMaterial);
} catch (IllegalArgumentException ex) {
mat = Material.WOOL;
mat = getDefaultConfirmMaterial();
Bukkit.getLogger().severe("Your accept-block material is invalid!");
}
return new ItemStack(mat, 1);
Expand All @@ -118,7 +118,7 @@ public ItemStack getCancelBlockItemStack() {
try {
mat = Material.valueOf(materialSplit[0]);
} catch (IllegalArgumentException ex) {
mat = Material.WOOL;
mat = getDefaultCancelMaterial();
Bukkit.getLogger().severe("Your cancel-block material is invalid!");
}
short damage;
Expand All @@ -133,7 +133,7 @@ public ItemStack getCancelBlockItemStack() {
try {
mat = Material.valueOf(rawMaterial);
} catch (IllegalArgumentException ex) {
mat = Material.WOOL;
mat = getDefaultCancelMaterial();
Bukkit.getLogger().severe("Your cancel-block material is invalid!");
}
return new ItemStack(mat, 1);
Expand Down Expand Up @@ -396,4 +396,34 @@ public int getMaximumY(Player p) {
public double getConfigVersion() {
return main.getConfig().getDouble("config-version");
}

private Material getDefaultCancelMaterial() {
Material mat;
if (Bukkit.getVersion().contains("1.13")) {
mat = Material.valueOf("RED_WOOL");
} else {
mat = Material.valueOf("WOOL");
}
return mat;
}

private Material getDefaultConfirmMaterial() {
Material mat;
if (Bukkit.getVersion().contains("1.13")) {
mat = Material.valueOf("GREEN_WOOL");
} else {
mat = Material.valueOf("WOOL");
}
return mat;
}

private Material getEnderPortalMaterial() {
Material mat;
if (Bukkit.getVersion().contains("1.13")) {
mat = Material.valueOf("END_PORTAL_FRAME");
} else {
mat = Material.valueOf("ENDER_PORTAL_FRAME");
}
return mat;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.utils;
package codes.biscuit.chunkbuster.utils;

public enum HookType {
MCOREFACTIONS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package xyz.biscut.chunkbuster.utils;
package codes.biscuit.chunkbuster.utils;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import xyz.biscut.chunkbuster.ChunkBuster;
import xyz.biscut.chunkbuster.hooks.FactionsUUIDHook;
import xyz.biscut.chunkbuster.hooks.MCoreFactionsHook;
import xyz.biscut.chunkbuster.hooks.WorldGuardHook;
import codes.biscuit.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.hooks.FactionsUUIDHook;
import codes.biscuit.chunkbuster.hooks.MCoreFactionsHook;
import codes.biscuit.chunkbuster.hooks.WorldGuardHook;

public class HookUtils {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.biscut.chunkbuster.utils;
package codes.biscuit.chunkbuster.utils;

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
Expand All @@ -12,8 +12,8 @@
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.biscut.chunkbuster.ChunkBuster;
import xyz.biscut.chunkbuster.timers.RemovalQueue;
import codes.biscuit.chunkbuster.ChunkBuster;
import codes.biscuit.chunkbuster.timers.RemovalQueue;

import java.io.BufferedReader;
import java.io.InputStreamReader;
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/xyz/biscut/chunkbuster/events/OtherEvents.java

This file was deleted.

7 changes: 4 additions & 3 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#########################################################################

chunkbuster:
# Please use 1.8 material names from here or any other 1.8 javadocs.
# https://biscut.xyz/javadocs/org/bukkit/Material.html
# Damage values supported.
# Please use item names for your specific version.
# 1.8: https://biscuit.codes/javadocs/org/bukkit/Material.html
# 1.13: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
# Damage values supported for > 1.13.
material: 'ENDER_PORTAL_FRAME'
name: '&aChunk Buster'
lore:
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
main: xyz.biscut.chunkbuster.ChunkBuster
main: codes.biscuit.chunkbuster.ChunkBuster
version: ${version}
api-version: 1.13
name: ChunkBuster
author: Biscut
softdepend: [MassiveCore, Factions, WorldGuard]
Expand Down

0 comments on commit a397426

Please sign in to comment.