Skip to content

Commit

Permalink
rename also update to paper 1.16.5
Browse files Browse the repository at this point in the history
  • Loading branch information
willemml committed Apr 21, 2021
1 parent 3208833 commit 2751d06
Show file tree
Hide file tree
Showing 35 changed files with 1,035 additions and 372 deletions.
28 changes: 0 additions & 28 deletions .gitlab-ci.yml

This file was deleted.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: "java"
apply plugin: 'java'

group = "net.willemml"
version = "2.0"
group = 'net.blazenarchy'
version = 'v2.0.1'

sourceCompatibility = "1.8"
targetCompatibility = "1.8"
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
mavenCentral()
maven {
url = "https://papermc.io/repo/repository/maven-public/"
}
maven {
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url = "https://repo.dmulloy2.net/nexus/repository/public/"
}
}

dependencies {
compileOnly "com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT"
compileOnly "com.comphenix.protocol:ProtocolLib:4.5.0"
compileOnly "com.comphenix.protocol:ProtocolLib:4.6.0"
compileOnly 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT'
}

processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'paperstack'
rootProject.name = 'ream'
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package net.willemml.paperstack;
package net.blazenarchy.ream;

import net.willemml.paperstack.permissions.PermissionsUtility;
import net.willemml.paperstack.player.LastLocation;
import net.willemml.paperstack.player.PlayerData;
import net.willemml.paperstack.player.PlayerDataUtilities;
import net.blazenarchy.ream.permissions.PermissionsUtility;
import net.blazenarchy.ream.player.LastLocation;
import net.blazenarchy.ream.player.PlayerData;
import net.blazenarchy.ream.player.PlayerDataUtilities;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
Expand All @@ -20,7 +21,7 @@ public class GeneralUtilities {

public static String parsePlaceholders(Player player, String string) {
String prefix = PlayerDataUtilities.loadPlayerData(player).getGroup().getPrefix().replaceAll("&(?=[0-9]|[a-f]|[k-o]|r)", "§").replace("%", "%%");
String displayName = player.getDisplayName().replace("%", "%%");
String displayName = player.displayName().toString().replace("%", "%%");
String name = player.getName().replace("%", "%%");
return string.replaceAll("&(?=[0-9]|[a-f]|[k-o]|r)", "§")
.replace("%prefix%", prefix)
Expand All @@ -30,7 +31,7 @@ public static String parsePlaceholders(Player player, String string) {

public static void teleportPlayer(Player player, Location destination) {
GeneralUtilities.hidePlayer(player);
PaperStack.playerPosTracking.remove(player.getUniqueId());
Ream.playerPosTracking.remove(player.getUniqueId());
PlayerDataUtilities.loadPlayerData(player).setLogoutLocation(LastLocation.fromLocation(destination)).save();
double worldBorder = destination.getWorld().getWorldBorder().getSize();
Random random = new Random();
Expand All @@ -46,7 +47,7 @@ public static void teleportPlayer(Player player, Location destination) {
}
}
player.teleport(destination);
PaperStack.playerPosTracking.remove(player.getUniqueId());
Ream.playerPosTracking.remove(player.getUniqueId());
GeneralUtilities.unhidePlayer(player);
}

Expand All @@ -58,16 +59,16 @@ public static void sendPrivateMessage(Player sender, Player receiver, String...
}
if (message.length() == 0) sender.sendMessage(ChatColor.RED + "You cannot send an empty message.");
else {
PaperStack.messageReply.remove(sender.getUniqueId());
PaperStack.messageReply.put(sender.getUniqueId(), receiver.getUniqueId());
PaperStack.messageReply.remove(receiver.getUniqueId());
PaperStack.messageReply.put(receiver.getUniqueId(), sender.getUniqueId());
sender.sendMessage(ChatColor.GRAY + "you -> " + ChatColor.RESET + receiver.getDisplayName() + ChatColor.GRAY + ": " + ChatColor.RESET + message);
receiver.sendMessage(sender.getDisplayName() + ChatColor.GRAY + " -> " + "you: " + ChatColor.RESET + message);
Ream.messageReply.remove(sender.getUniqueId());
Ream.messageReply.put(sender.getUniqueId(), receiver.getUniqueId());
Ream.messageReply.remove(receiver.getUniqueId());
Ream.messageReply.put(receiver.getUniqueId(), sender.getUniqueId());
sender.sendMessage(ChatColor.GRAY + "you -> " + ChatColor.RESET + receiver.displayName().toString() + ChatColor.GRAY + ": " + ChatColor.RESET + message);
receiver.sendMessage(sender.displayName().toString() + ChatColor.GRAY + " -> " + "you: " + ChatColor.RESET + message);
}
return;
}
sender.sendMessage(ChatColor.RED + receiver.getDisplayName() + " is ignoring you.");
sender.sendMessage(ChatColor.RED + receiver.displayName().toString() + " is ignoring you.");
}

public static void cleanInventory(Inventory inventory) {
Expand All @@ -86,27 +87,27 @@ public static void notEnoughTokens(Player player, long needed) {
}

public static void checkForIllegals(Player player) {
checkForIllegals(player.getInventory(), !player.hasPermission("nukestack.illegal"), !player.hasPermission("nukestack.overstack"), false, player.getWorld(), player.getLocation());
checkForIllegals(player.getInventory(), !player.hasPermission("ream.illegal"), !player.hasPermission("ream.overstack"), false, player.getWorld(), player.getLocation());
}

public static void checkForIllegals(Inventory inventory, boolean removeIllegals, boolean unstackOverStacked, boolean dupe, @Nullable World world, @Nullable Location location) {
if (dupe || (removeIllegals && PaperStack.deleteItems) || (unstackOverStacked && PaperStack.unstackItems)) {
if (dupe || (removeIllegals && Ream.deleteItems) || (unstackOverStacked && Ream.unstackItems)) {
for (ItemStack itemStack : inventory) {
if (itemStack != null) {
if (removeIllegals && PaperStack.deleteItems) {
if (PaperStack.DELETE.contains(itemStack.getType())) {
if (removeIllegals && Ream.deleteItems) {
if (Ream.DELETE.contains(itemStack.getType())) {
inventory.remove(itemStack);
}
}
if (unstackOverStacked && PaperStack.unstackItems) {
if (PaperStack.NO_STACK.contains(itemStack.getType())) {
if (unstackOverStacked && Ream.unstackItems) {
if (Ream.NO_STACK.contains(itemStack.getType())) {
int maxStack = itemStack.getMaxStackSize();
if (itemStack.getAmount() > maxStack) itemStack.setAmount(maxStack);
}
}
if (dupe) {
if (world != null && location != null) {
if (!PaperStack.NO_DUPE.contains(itemStack.getType())) {
if (!Ream.NO_DUPE.contains(itemStack.getType())) {
world.dropItemNaturally(location, itemStack);
}
}
Expand All @@ -117,47 +118,47 @@ public static void checkForIllegals(Inventory inventory, boolean removeIllegals,
}

public static void performLogout(Player player) {
PaperStack.messageReply.remove(player.getUniqueId());
PaperStack.teleportRequests.remove(player.getUniqueId());
PaperStack.playerPosTracking.remove(player.getUniqueId());
Ream.messageReply.remove(player.getUniqueId());
Ream.teleportRequests.remove(player.getUniqueId());
Ream.playerPosTracking.remove(player.getUniqueId());
checkForIllegals(player);
PlayerDataUtilities.loadPlayerData(player).setLogoutLocation(LastLocation.fromLocation(player.getLocation())).save();
if (PaperStack.permissions) {
if (Ream.permissions) {
PermissionAttachment attachment = PermissionsUtility.permissionsMap.get(player.getUniqueId());
if (attachment != null) attachment.remove();
PermissionsUtility.permissionsMap.remove(player.getUniqueId());
}
}

public static void setPlayerList(Player player) {
player.setPlayerListHeaderFooter(parsePlaceholders(player, PaperStack.playerListHeader), parsePlaceholders(player, PaperStack.playerListFooter));
player.setPlayerListName(parsePlaceholders(player, PaperStack.nameFormat));
player.sendPlayerListHeaderAndFooter(Component.text(parsePlaceholders(player, Ream.playerListHeader)), Component.text(parsePlaceholders(player, Ream.playerListFooter)));
player.playerListName(Component.text(parsePlaceholders(player, Ream.nameFormat)));
}

public static void performLogin(Player player) {
if (PaperStack.deleteOversizedItems) {
if (Ream.deleteOversizedItems) {
cleanInventory(player.getInventory());
}
checkForIllegals(player);
PlayerData playerData = PlayerDataUtilities.loadPlayerData(player);
if (PaperStack.permissions) playerData.loadPermissions();
if (PaperStack.loginTeleport) {
Location logSpot = playerData.getLogoutLocation(PaperStack.PLUGIN.getServer());
if (Ream.permissions) playerData.loadPermissions();
if (Ream.loginTeleport) {
Location logSpot = playerData.getLogoutLocation(Ream.PLUGIN.getServer());
if (logSpot != null) {
teleportPlayer(player, logSpot);
}
}
}

public static void hidePlayer(Player player) {
for (Player other : PaperStack.PLUGIN.getServer().getOnlinePlayers()) {
other.hidePlayer(PaperStack.PLUGIN, player);
for (Player other : Ream.PLUGIN.getServer().getOnlinePlayers()) {
other.hidePlayer(Ream.PLUGIN, player);
}
}

public static void unhidePlayer(Player player) {
for (Player other : PaperStack.PLUGIN.getServer().getOnlinePlayers()) {
other.showPlayer(PaperStack.PLUGIN, player);
for (Player other : Ream.PLUGIN.getServer().getOnlinePlayers()) {
other.showPlayer(Ream.PLUGIN, player);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.willemml.paperstack;
package net.blazenarchy.ream;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
Expand All @@ -9,12 +9,13 @@
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.willemml.paperstack.commands.*;
import net.willemml.paperstack.permissions.Group;
import net.willemml.paperstack.permissions.PermissionsUtility;
import net.willemml.paperstack.player.PlayerData;
import net.willemml.paperstack.player.PlayerDataUtilities;
import net.willemml.paperstack.commands.*;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.blazenarchy.ream.commands.*;
import net.blazenarchy.ream.permissions.Group;
import net.blazenarchy.ream.permissions.PermissionsUtility;
import net.blazenarchy.ream.player.PlayerData;
import net.blazenarchy.ream.player.PlayerDataUtilities;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang.SerializationUtils;
import org.bukkit.ChatColor;
import org.bukkit.Location;
Expand All @@ -38,13 +39,13 @@
*
* @author wnuke
*/
public final class PaperStack extends JavaPlugin implements Listener {
public final class Ream extends JavaPlugin implements Listener {
public static final HashSet<String> BLOCKED_NICK = new HashSet<>();
public static final HashSet<Material> DELETE = new HashSet<>();
public static final HashSet<Material> NO_DUPE = new HashSet<>();
public static final HashSet<Material> NO_STACK = new HashSet<>();
public static final Gson gson = new GsonBuilder().serializeNulls().create();
public static PaperStack PLUGIN;
public static Ream PLUGIN;
public static String chatFormat = "&r<%prefix%%display_name%&r> %message%";
public static String nameFormat = "&r%prefix%%name%&r";
public static String playerListHeader = "";
Expand Down Expand Up @@ -212,7 +213,7 @@ public void onPacketSending(PacketEvent event) {
}
}
getServer().getPluginManager().registerEvents(this, this);
getLogger().info("Loaded NukeStack by wnuke.");
getLogger().info("Loaded ream.");
}

@Override
Expand All @@ -226,21 +227,21 @@ public void onDisable() {
teleportRequests.clear();
playerPosTracking.clear();
messageReply.clear();
getLogger().info("Disabled NukeStack by wnuke.");
getLogger().info("Disabled ream.");
}

@EventHandler
public void onChatMessage(AsyncPlayerChatEvent event) {
public void onChatMessage(AsyncChatEvent event) {
Player player = event.getPlayer();
if (ignore)
event.getRecipients().removeIf(p -> PlayerDataUtilities.loadPlayerData(p).hasIgnored(player.getUniqueId()));
event.recipients().removeIf(p -> PlayerDataUtilities.loadPlayerData(p).hasIgnored(player.getUniqueId()));
if (chat) {
String message = event.getMessage().replace("%", "%%");
if (player.hasPermission("nukestack.colourchat")) message.replaceAll("&(?=[0-9]|[a-f]|r)", "§");
if (player.hasPermission("nukestack.formatchat")) message.replaceAll("&(?=[k-o]|r)", "§");
String message = event.message().toString().replace("%", "%%");
if (player.hasPermission("ream.colourchat")) message = message.replaceAll("&(?=[0-9]|[a-f]|r)", "§");
if (player.hasPermission("ream.formatchat")) message = message.replaceAll("&(?=[k-o]|r)", "§");
if (message.startsWith(">")) message = ChatColor.GREEN + message;
String format = GeneralUtilities.parsePlaceholders(player, chatFormat).replace("%message%", message);
event.setFormat(format);
event.message(Component.text(format));
}
}

Expand All @@ -260,13 +261,13 @@ public void onDeath(PlayerDeathEvent event) {
if (killer.getAddress().getAddress().equals(killed.getAddress().getAddress())) return;
PlayerDataUtilities.loadPlayerData(killer).incrementStreak().save();
}
if (toggleDeathMessages && event.getDeathMessage() != null) {
if (toggleDeathMessages && event.deathMessage() != null) {
for (Player player : getServer().getOnlinePlayers()) {
if (PlayerDataUtilities.loadPlayerData(player).deathMessages()) {
player.sendMessage(event.getDeathMessage());
player.sendMessage(Objects.requireNonNull(event.deathMessage()));
}
}
event.setDeathMessage(null);
event.deathMessage(null);
}
}

Expand All @@ -275,13 +276,13 @@ public void onPlayerJoin(PlayerJoinEvent event) {
GeneralUtilities.performLogin(event.getPlayer());
if (playerList) GeneralUtilities.setPlayerList(event.getPlayer());
if (!event.getPlayer().hasPlayedBefore() && newPlayerMessage) {
getServer().broadcastMessage(ChatColor.AQUA + event.getPlayer().getDisplayName() + " joined for the first time!");
event.setJoinMessage(null);
getServer().broadcast(Component.text(ChatColor.AQUA + event.getPlayer().displayName().toString() + " joined for the first time!"), "");
event.joinMessage(null);
}
PlayerData joinedPlayerData = PlayerDataUtilities.loadPlayerData(event.getPlayer());
String nick = joinedPlayerData.getNickName();
if (!nick.isEmpty()) {
event.getPlayer().setDisplayName(nick);
event.getPlayer().displayName(Component.text(nick));
}
}

Expand Down Expand Up @@ -326,7 +327,7 @@ public void onTick(ServerTickEndEvent event) {
for (Player player : getServer().getOnlinePlayers()) {
if (antiSpeed) {
if (!player.isDead()) {
if (!player.hasPermission("nukestack.cheat")) {
if (!player.hasPermission("ream.cheat")) {
UUID playerID = player.getUniqueId();
Location playerPos = player.getLocation();
if (playerPosTracking.containsKey(playerID)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package net.willemml.paperstack.commands;
package net.blazenarchy.ream.commands;

import net.willemml.paperstack.player.PlayerDataUtilities;
import net.blazenarchy.ream.player.PlayerDataUtilities;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class Balance implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!(sender instanceof ConsoleCommandSender)) {
Player player = ((Player) sender).getPlayer();
if (player == null) return false;
Expand Down
Loading

0 comments on commit 2751d06

Please sign in to comment.