Skip to content

Commit

Permalink
v2.5
Browse files Browse the repository at this point in the history
- Added bStats: https://bstats.org/plugin/bukkit/ToolKit/11896
- Added shortcuts for gamemodes:
    - gmc
    - gms
    - gma
    - gmsp
- Added thor troll
  • Loading branch information
czQery authored Jul 1, 2021
1 parent c61dbc5 commit 4f25888
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 91 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@
<img src="https://github.com/czQery/ToolKit/blob/master/banner.png?raw=true">
</p>

[![Version](https://img.shields.io/badge/version-v2.3-informational.svg)](https://github.com/czQery/ToolKit/releases)
[![Version](https://img.shields.io/badge/version-v2.5-informational.svg)](https://github.com/czQery/ToolKit/releases)
[![Releases](https://img.shields.io/badge/download-1.17-brightgreen.svg)](https://github.com/czQery/ToolKit/releases/latest/download/ToolKit.jar)

## Commands

| Command | Permission | Protection | Description |
| ----------------- | --------------------- | ------------------------- | --------------------------------------------- |
| /crash | toolkit.crash | toolkit.crash.bypass | Lag/Crash players game |
| /crasher | toolkit.crasher | toolkit.crasher.bypass | Lag/Crash players game |
| /crawl | toolkit.crawl | null | Allows the player to crawl |
| /sit | toolkit.sit | null | Allows the player to sit down |
| /skick | toolkit.skick | toolkit.skick.bypass | Badlion users cannot exit kick screen |
| /troll | toolkit.troll | toolkit.troll.bypass | Just troll command :) |
| /toolkit | null | null | Show info about plugin |
| /pinfo | toolkit.pinfo | null | Show info about player (even their client) |
| /rp | toolkit.rp | null | Set player resource pack |
| /pinfo | toolkit.pinfo | null | Show info about player (even their client) |
| /rp | toolkit.rp | null | Set player's resource pack |
| /gmc | toolkit.gmc | null | Switch player's gamemode to CREATIVE |
| /gms | toolkit.gms | null | Switch player's gamemode to SURVIVAL |
| /gma | toolkit.gma | null | Switch player's gamemode to ADVENTURE |
| /gmsp | toolkit.gmsp | null | Switch player's gamemode to SPECTATOR |

## Trolls

Expand All @@ -28,6 +32,7 @@
- Freeze
- FakeOp
- Flip
- Thor
- FakeDemo (soon)

## Events
Expand Down
32 changes: 26 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cz.qery</groupId>
<artifactId>ToolKit</artifactId>
<version>2.4</version>
<version>2.5</version>
<packaging>jar</packaging>

<name>ToolKit</name>
Expand All @@ -16,7 +16,7 @@
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>qery.cz</url>
<url>github.com/czQery/ToolKit</url>

<build>
<plugins>
Expand All @@ -33,6 +33,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>cz.qery.toolkit</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -60,16 +68,28 @@
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
33 changes: 22 additions & 11 deletions src/main/java/cz/qery/toolkit/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,34 @@

import cz.qery.toolkit.commands.*;
import cz.qery.toolkit.events.*;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.Messenger;

import java.util.Objects;

public final class Main extends JavaPlugin {

@Override
public void onEnable() {
loadConfiguration();

String b = this.getConfig().getString("color.bracket");
String n = this.getConfig().getString("color.name");

Objects.requireNonNull(getCommand("crash")).setExecutor(new Crash());
Objects.requireNonNull(getCommand("crawl")).setExecutor(new Crawl());
Objects.requireNonNull(getCommand("toolkit")).setExecutor(new ToolKit());
Objects.requireNonNull(getCommand("skick")).setExecutor(new SKick());
Objects.requireNonNull(getCommand("sit")).setExecutor(new Sit());
Objects.requireNonNull(getCommand("troll")).setExecutor(new Troll());
Objects.requireNonNull(getCommand("pinfo")).setExecutor(new PInfo());
Objects.requireNonNull(getCommand("rp")).setExecutor(new RP());

getCommand("crash").setExecutor(new Crash());
getCommand("crawl").setExecutor(new Crawl());
getCommand("toolkit").setExecutor(new ToolKit());
getCommand("skick").setExecutor(new SKick());
getCommand("sit").setExecutor(new Sit());
getCommand("troll").setExecutor(new Troll());
getCommand("pinfo").setExecutor(new PInfo());
getCommand("rp").setExecutor(new RP());
//Aliases
Objects.requireNonNull(getCommand("gmc")).setExecutor(new Aliases());
Objects.requireNonNull(getCommand("gms")).setExecutor(new Aliases());
Objects.requireNonNull(getCommand("gma")).setExecutor(new Aliases());
Objects.requireNonNull(getCommand("gmsp")).setExecutor(new Aliases());

new Interact(this);
new Join(this);
Expand All @@ -43,6 +48,12 @@ public void onEnable() {
ms.registerOutgoingPluginChannel(this, "fml:handshake");
ms.registerOutgoingPluginChannel(this, "fml:loginwrapper");
ms.registerOutgoingPluginChannel(this, "fml:play");



//bStats
int pluginId = 11896;
Metrics metrics = new Metrics(this, pluginId);
}

public void loadConfiguration() {
Expand Down
74 changes: 48 additions & 26 deletions src/main/java/cz/qery/toolkit/Scripts.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,76 @@ public static void bCheck(Player p) {
int y = p.getLocation().getBlockY();
int z = p.getLocation().getBlockZ();

Location d1 = new Location(world, x, y-1, z);
Location d2 = new Location(world, x, y-2, z);
Location d1 = new Location(world, x, y - 1, z);
Location d2 = new Location(world, x, y - 2, z);

if (p.isOnGround()) {
if (p.getLocation().getY() % 1 > 0.25) {
p.setMetadata("crawl", new FixedMetadataValue(plugin, false));
p.sendMessage(Tools.chat(b+"["+n+"CRAWL"+b+"]"+t+" Crawl mode has been turned &cOFF"+t+"!"));
Location loc = new Location(p.getWorld(), p.getLocation().getBlockX(), p.getLocation().getBlockY()+1, p.getLocation().getBlockZ());
if (loc.getBlock().getType() == Material.BARRIER){loc.getBlock().setType(Material.AIR);}
p.sendMessage(Tools.chat(b + "[" + n + "CRAWL" + b + "]" + t + " Crawl mode has been turned &cOFF" + t + "!"));
Location loc = new Location(p.getWorld(), p.getLocation().getBlockX(), p.getLocation().getBlockY() + 1, p.getLocation().getBlockZ());
if (loc.getBlock().getType() == Material.BARRIER) {
loc.getBlock().setType(Material.AIR);
}
}
}

if (d1.getBlock().isEmpty() && d2.getBlock().isEmpty()) {
p.setMetadata("crawl", new FixedMetadataValue(plugin, false));
p.sendMessage(Tools.chat(b+"["+n+"CRAWL"+b+"]"+t+" Crawl mode has been turned &cOFF"+t+"!"));
Location loc = new Location(p.getWorld(), p.getLocation().getBlockX(), p.getLocation().getBlockY()+1, p.getLocation().getBlockZ());
if (loc.getBlock().getType() == Material.BARRIER){loc.getBlock().setType(Material.AIR);}
p.sendMessage(Tools.chat(b + "[" + n + "CRAWL" + b + "]" + t + " Crawl mode has been turned &cOFF" + t + "!"));
Location loc = new Location(p.getWorld(), p.getLocation().getBlockX(), p.getLocation().getBlockY() + 1, p.getLocation().getBlockZ());
if (loc.getBlock().getType() == Material.BARRIER) {
loc.getBlock().setType(Material.AIR);
}
}


for (int i = 1; i < 3; i++) {
if (i == 2) {
Location l0 = new Location(world, x, y+i, z);
if (l0.getBlock().getType() == Material.BARRIER){l0.getBlock().setType(Material.AIR);}
Location l0 = new Location(world, x, y + i, z);
if (l0.getBlock().getType() == Material.BARRIER) {
l0.getBlock().setType(Material.AIR);
}
}
Location l1 = new Location(world, x + 1, y + i, z);
if (l1.getBlock().getType() == Material.BARRIER) {
l1.getBlock().setType(Material.AIR);
}
Location l1 = new Location(world, x+1, y+i, z);
if (l1.getBlock().getType() == Material.BARRIER){l1.getBlock().setType(Material.AIR);}
//
Location l2 = new Location(world, x-1, y+i, z);
if (l2.getBlock().getType() == Material.BARRIER){l2.getBlock().setType(Material.AIR);}
Location l2 = new Location(world, x - 1, y + i, z);
if (l2.getBlock().getType() == Material.BARRIER) {
l2.getBlock().setType(Material.AIR);
}
//
Location l3 = new Location(world, x, y+i, z+1);
if (l3.getBlock().getType() == Material.BARRIER){l3.getBlock().setType(Material.AIR);}
Location l3 = new Location(world, x, y + i, z + 1);
if (l3.getBlock().getType() == Material.BARRIER) {
l3.getBlock().setType(Material.AIR);
}
//
Location l4 = new Location(world, x, y+i, z-1);
if (l4.getBlock().getType() == Material.BARRIER){l4.getBlock().setType(Material.AIR);}
Location l4 = new Location(world, x, y + i, z - 1);
if (l4.getBlock().getType() == Material.BARRIER) {
l4.getBlock().setType(Material.AIR);
}
//
Location l5 = new Location(world, x+1, y+i, z+1);
if (l5.getBlock().getType() == Material.BARRIER){l5.getBlock().setType(Material.AIR);}
Location l5 = new Location(world, x + 1, y + i, z + 1);
if (l5.getBlock().getType() == Material.BARRIER) {
l5.getBlock().setType(Material.AIR);
}
//
Location l6 = new Location(world, x+1, y+i, z-1);
if (l6.getBlock().getType() == Material.BARRIER){l6.getBlock().setType(Material.AIR);}
Location l6 = new Location(world, x + 1, y + i, z - 1);
if (l6.getBlock().getType() == Material.BARRIER) {
l6.getBlock().setType(Material.AIR);
}
//
Location l7 = new Location(world, x-1, y+i, z+1);
if (l7.getBlock().getType() == Material.BARRIER){l7.getBlock().setType(Material.AIR);}
Location l7 = new Location(world, x - 1, y + i, z + 1);
if (l7.getBlock().getType() == Material.BARRIER) {
l7.getBlock().setType(Material.AIR);
}
//
Location l8 = new Location(world, x-1, y+i, z-1);
if (l8.getBlock().getType() == Material.BARRIER){l8.getBlock().setType(Material.AIR);}
Location l8 = new Location(world, x - 1, y + i, z - 1);
if (l8.getBlock().getType() == Material.BARRIER) {
l8.getBlock().setType(Material.AIR);
}
}
}
}
61 changes: 61 additions & 0 deletions src/main/java/cz/qery/toolkit/commands/Aliases.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package cz.qery.toolkit.commands;

import cz.qery.toolkit.Main;
import cz.qery.toolkit.Tools;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public class Aliases implements CommandExecutor {

Plugin plugin = Main.getPlugin(Main.class);
String b = plugin.getConfig().getString("color.bracket");
String n = plugin.getConfig().getString("color.name");
String t = plugin.getConfig().getString("color.text");
String h = plugin.getConfig().getString("color.highlight");

public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {

if (!(sender instanceof Player)) {
Tools.log(b+"["+n+"SERVER"+b+"]"+t+" This command cannot be used by the console!");
} else {
Player p = (Player) sender;
if (!p.hasPermission("toolkit."+cmd.getName().toLowerCase())) {
p.sendMessage(Tools.chat(b + "[" + n + "SERVER" + b + "]" + t + " You're not allowed to do this!"));
} else {
Player target;
if (args.length > 0) {
target = Bukkit.getServer().getPlayer(args[0]);
} else {
target = p;
}
switch (cmd.getName().toLowerCase()) {
case "gmc":
target.setGameMode(GameMode.CREATIVE);
p.sendMessage(Tools.chat(b + "[" + n + "SERVER" + b + "]" + t + " Switched to " + h + "CREATIVE"));
break;
case "gms":
target.setGameMode(GameMode.SURVIVAL);
p.sendMessage(Tools.chat(b + "[" + n + "SERVER" + b + "]" + t + " Switched to " + h + "SURVIVAL"));
break;
case "gma":
target.setGameMode(GameMode.ADVENTURE);
p.sendMessage(Tools.chat(b + "[" + n + "SERVER" + b + "]" + t + " Switched to " + h + "ADVENTURE"));
break;
case "gmsp":
target.setGameMode(GameMode.SPECTATOR);
p.sendMessage(Tools.chat(b + "[" + n + "SERVER" + b + "]" + t + " Switched to " + h + "SPECTATOR"));
break;
}
}
}
return false;
}
}
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/commands/ToolKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
github.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/czQery/ToolKit"));

p.sendMessage(Tools.chat(b+"-------["+n+"TOOLKIT"+b+"]-------"));
p.sendMessage(Tools.chat(b+"- "+t+"Very useful plugin :))"));
p.sendMessage(Tools.chat(b+"- "+t+"Set of useful tools"));
p.sendMessage(Tools.chat(b+"- "+t+"Version "+h+version));
p.spigot().sendMessage(github);
p.sendMessage(Tools.chat(b+"- "+t+"Made by "+h+"czQery"));
Expand Down
Loading

0 comments on commit 4f25888

Please sign in to comment.