ForceUHC Plugin

Status
This thread has been locked.

FusionDevTeam

Feedback score
0
Posts
29
Reactions
6
Resources
0
Hello MC-Market
Im here to present you my UHC plugin. Version 1.0.

THIS IS A FORK (EDITED AND OPTIMIZED) OF VENTIX UHC


ForceUHC 1.0

TEST SERVER

» Soon

PRICE
» Source without updates: $15
» Source with updates: 20$
» Jar: $8
» Re-sell right: 25$
Contact me on discord - LobbySelector#7934

ForceUHC is a optimized UHC plugin with loot of features.
» Arena fully customizable in every way
* https://gyazo.com/aeecb75372bf304633f8c2b274c23315

» Optimazed scatter (Scatters 1 player per 0.5s (can be changed if you want)

» 30 Scenarios (Vanilla+ , GoneFishing, Golden Retriever, Diamondless, Fireless, and more..)

» Custom scoreboard in Lobby, on scatter, In FFA game, solo Game and Game end and on world creation.
* https://gyazo.com/efe4d256f5811c036bc9c1b0b5462e97
* https://gyazo.com/b0a02315dc16072c48bd23b3c18e1246
* https://gyazo.com/d8ec88a367a4c8ecfac5d408ee62a487
* https://gyazo.com/32369579dfbd3879063b11e997354fb0
* https://gyazo.com/c53d98ec791d321c04e594c7ab4f668a
* https://gyazo.com/4b19fe46dbfcc7700c2c867e35f4a1de
* https://gyazo.com/b065c9c432a3da3b0754170e59b9c1c5
* For ingame contact me on discord (don't have any pic)
- Changes: added Heal timer and fixed colors for it

» Custom World Options
* https://gyazo.com/c96a0b5e26e9c471bedc256dfb3a9305 (same for nether)
* https://gyazo.com/bfef9b0e75615fad7e46e97471d694ab (same for nether)
!! NOTE: When you create and load map server will auto restart after starting you must join again and just create the world again even if he exists ! YOU DON'T NEED TO LOAD MAP AGAIN.

» WorldBorder (Only with bedrock)
» BorderShrink

» Freeze

» Stats (MySQL needed)

» Custom Game GUI
* https://gyazo.com/bd7d0d64df7d80e2278dddc407deae14
* https://gyazo.com/96ba19fddd98b9a2baad194dbba6c1c6 (Only staf has perms for this)
* https://gyazo.com/e370e16cfdde0d57159e0bff6cf7676e
* and more..

» Editable configuration
* https://gyazo.com/1c75a4872ddc7a43f7812d62aa595c02
* https://gyazo.com/5db0dfefdd70dc70920f80d267792d46 (Chat config if something is not added to gui)
* https://gyazo.com/9f965c3fe06efec9c651e72be4e9f9a7 (Config from game GUI)

» Colors (To edit all colors including tab and scoreboard)
* https://gyazo.com/27bdbecf6054cbbe72c22b8d7ce1ee1b
* https://gyazo.com/0753e757488fd67fbf664de673890489

» Friend command for donators to whitelist friends
* https://gyazo.com/7304a43807031b5726c342b4d657b3ae

» Moderation and Host
* https://gyazo.com/832ed9d7b383c783f6912bf319e86c3d
* https://gyazo.com/814b22a168ea0570d9ee892159e89798 (Inventory items when you are added as staff)
* Host: https://gyazo.com/4ba6eac1e2db6697d440e0df06e2202d

» Scoreboard Title (this changes Tab and scoreboard name)
* https://gyazo.com/c964d5e2036219537f9a34684a5681c6
* https://gyazo.com/e46a06eb39749bfcf2f479edd7aaee75\
!!NOTE: You can use _ for space!

» Teams (Partyes)
* https://gyazo.com/1c23bbaae355855b1f94bc4d8f4e83c3
* https://gyazo.com/808e7146838b4a260b337b65aa6f32e4

» E
dit Inv (Edit starter inventory)
* https://gyazo.com/8d7228b03c47c30933f13a8a264684c7

» Custom Start Event
* https://gyazo.com/8730defd89858a760c04250509d6c5a3

» Spectator mode
* Custom join items included

» Next UHC (auto scatter)
* https://gyazo.com/32fd689e9a8fd0dc372b3201cfc87143
* This goes <hour> <minute>. type 0 0 if you want to disable for only hours you can type 1 0 or for only minutes 0 1

» Bossbar (can be disabled)
» Contact me on discord for more pictures or any more informations
» Flat 25x25 on border shrink
» Allow players to destroy blocks in 25x25 (or you can disable that in config)

Permissions
» Operator (uhc.op)
»
Staff (uhc.staff)
»
Staff+ (uhc.staff+)
»
Host (uhc.host)
»
Admin (uhc.admin)
»
Donator (uhc.donator)
»
Youtuber or Media (uhc.youtuber)

Code:
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scoreboard.Scoreboard;

import me.lobbyselector.uhc.UHCPlugin;
import me.lobbyselector.uhc.states.GameState;
import me.lobbyselector.uhc.utilies.Permission;
import me.lobbyselector.uhc.utilies.chat.Server;
import me.lobbyselector.uhc.utilies.configs.ConfigIntegers;
import me.lobbyselector.uhc.utilies.player.PlayerManager;
import me.lobbyselector.uhc.utilies.player.UHCPlayer;
import me.lobbyselector.uhc.utilies.runnable.BorderRunnable;
import me.lobbyselector.uhc.utilies.runnable.GameRunnable;

@SuppressWarnings("all")
public class GameManager {
    public static GameManager instance;
    public FileConfiguration config;
    public GameRunnable gameRunnable;
    public BorderRunnable borderRunnable;
    public Map<Player, Scoreboard> scoreboardMap;
    public String scoreboardTitle;
    public String scoreboardIP;
    public String prefix;
    public String borderPrefix;
    public String configPrefix;
    public String helpopPrefix;
    public String uhcWorld;
    public String restartCommand;
    public int defaultMapSize;
    public int currentBorder;
    public int randomShrinkAtAndBelow;
    public boolean borderShrinks;
    public boolean statsEnabled;
    public boolean gameRunning;
    public boolean scattering;
    public boolean pvpEnabled;
    public boolean mapGenerating;
    public boolean restartOnEnd;
    public Set<Player> moderators;
    public Set<Chunk> chunks;
    public ItemStack playersAlive;
    public ItemStack randomPlayer;
    public Player host;
    public ArrayList<UUID> arenaplayers;
    private int arenamax;
    private boolean Arena_Enabled;
    private static GameState gameState = GameState.LOBBY;
    private String winner;
    private int restartseconds;
    public boolean isthanks;
    public boolean deathmatch = false;

    public GameManager() {
        this.gameState = GameState.LOBBY;
        this.Arena_Enabled = false;
        this.isthanks = false;
        this.arenamax = 50;
        this.arenaplayers = new ArrayList<UUID>();
        this.config = UHCPlugin.getInstance().getConfig();
        this.gameRunnable = null;
        this.borderRunnable = null;
        this.scoreboardMap = new HashMap<Player, Scoreboard>();
        this.prefix = ChatColor.translateAlternateColorCodes('&', this.config.getString("settings.uhc-prefix"));
        this.borderPrefix = ChatColor.translateAlternateColorCodes('&',
                this.config.getString("settings.border-prefix"));
        this.configPrefix = ChatColor.translateAlternateColorCodes('&',
                this.config.getString("settings.config-prefix"));
        this.uhcWorld = this.config.getString("settings.uhc-world-name");
        this.restartCommand = this.config.getString("settings.restart-command");
        this.defaultMapSize = this.config.getInt("settings.default-map-size");
        this.currentBorder = this.defaultMapSize;
        this.randomShrinkAtAndBelow = this.config.getInt("settings.random-border-shrink-at-and-below");
        this.borderShrinks = true;
        this.statsEnabled = this.config.getBoolean("stats.enabled");
        this.gameRunning = false;
        this.scattering = false;
        this.pvpEnabled = false;
        this.mapGenerating = false;
        this.restartOnEnd = this.config.getBoolean("settings.restart-on-game-finish");
        this.moderators = new HashSet<Player>();
        this.chunks = new HashSet<Chunk>();
        this.playersAlive = this.newItem(Material.WATCH, "§6Players Alive", 0);
        this.randomPlayer = this.newItem(Material.ANVIL, "§6Random Player", 3);
        this.winner = "";
        this.restartseconds = 0;
    }

    public boolean canBorderShrink() {
        return this.borderShrinks;
    }

    public void setMapSize(int size) {
        this.currentBorder = size;
        UHCPlugin.getInstance().saveConfig();
    }

    public String getWinner() {
        return this.winner;
    }

    public int getWinnerKills() {
        Player player = Bukkit.getPlayer(this.getWinner());
        UHCPlayer uhcplayer = PlayerManager.getPlayerManager().getUHCPlayer(player.getUniqueId());

        return uhcplayer.getKills();
    }

    public int getTeamsWinnerKills() {
        Player player = Bukkit.getPlayer(this.getWinner());

        return TeamManager.getInstance().getTeam((OfflinePlayer) player).getKills();
    }

    public void setWinner(String winner) {
        this.winner = winner;
    }

    public boolean isArenaEnabled() {
        return this.Arena_Enabled;
    }
 
    public void setDeathmatch(boolean b) {
        deathmatch = b;
    }
 
    public boolean isDeathmatch() {
        return deathmatch;
    }
 
    public boolean isThanked() {
        return this.isthanks;
    }

    public ArrayList<UUID> getArenaPlayers() {
        return this.arenaplayers;
    }

    public static GameState getPlayerState() {
        return gameState;
    }

    public void setGameState(GameState playerState) {
        this.gameState = playerState;
    }

    public boolean isinArena(UUID playeruuid) {
        return this.arenaplayers.contains(playeruuid);
    }

    public int getArenaMaxPlayers() {
        return this.arenamax;
    }

    public boolean setArenaEnabled(boolean is) {
        return this.Arena_Enabled = is;
    }

    public void setMaxArenaPlayers(int max) {
        this.arenamax = max;
    }

    public void setCanBorderShrink(final boolean borderShrinks) {
        this.borderShrinks = borderShrinks;
    }

    public String getRestartCommand() {
        return this.restartCommand;
    }

    public int getRestartSeconds() {
        return this.restartseconds;
    }

    public String gameType() {
        if (TeamManager.getInstance().isTeamsEnabled()) {
            return "To" + TeamManager.getInstance().getMaxSize();
        }
        return "FFA";
    }

    public static GameManager getGameManager() {
        return GameManager.instance;
    }

    public Set<Chunk> getChunks() {
        return this.chunks;
    }

    public ItemStack newItem(final Material mat, final String s, final int data) {
        final ItemStack ist = new ItemStack(mat, 1, (short) data);
        final ItemMeta im = ist.getItemMeta();
        im.setDisplayName(s);
        ist.setItemMeta(im);
        return ist;
    }

    String getScoreboardIP() {
        return this.scoreboardIP;
    }

    public String getScoreboardTitle() {
        return this.scoreboardTitle;
    }

    public boolean isStatsEnabled() {
        return this.statsEnabled;
    }

    public static void setInstance() {
        GameManager.instance = new GameManager();
    }

    public boolean restartOnEnd() {
        return this.restartOnEnd;
    }

    public Map<Player, Scoreboard> getScoreboardMap() {
        return this.scoreboardMap;
    }

    public void setHost(final Player host) {
        this.host = host;
    }

    public String getHostName() {
        if (this.host == null) {
            return "";
        }
        return this.host.getName();
    }

    public int getStaffOnline() {
        ArrayList<Player> staff = new ArrayList<Player>();
        for (Player online : Bukkit.getOnlinePlayers()) {
            if (online.hasPermission(Permission.STAFF_PERMISSION)) {
                staff.add(online);
            }
        }
        return staff.size();
    }

    public String getHelpopPrefix() {
        return this.helpopPrefix;
    }

    public Set<String> getModeratorsNames() {
        final Set<String> mods = new HashSet<String>();
        for (final Player p : this.moderators) {
            mods.add(p.getName());
        }
        return mods;
    }

    public Set<Player> getModerators() {
        return this.moderators;
    }

    public void setModerator(final Player player, final boolean b) {
        if (b) {
            PlayerManager.getPlayerManager().setStaffSpectating(true, player);
            this.moderators.add(player);

        } else {
            PlayerManager.getPlayerManager().setStaffSpectating(false, player);
            this.moderators.remove(player);

        }
    }

    public Location getScatterLocation() {
        final Random r = new Random();
        final int x = r.nextInt(this.currentBorder * 2) - this.currentBorder;
        final int z = r.nextInt(this.currentBorder * 2) - this.currentBorder;
        return new Location(this.getUHCWorld(), (double) x, this.getUHCWorld().getHighestBlockYAt(x, z) + 0.5,
                (double) z);
    }

    public Location getSpawnLocation() {
        final Location locations = Bukkit.getWorld("world").getSpawnLocation();
        return locations;
    }

    public boolean isPvpEnabled() {
        return this.pvpEnabled;
    }

    public void startRestartSecond(int seconds) {
        restartseconds = seconds;
        Bukkit.broadcastMessage("§7§l§m------------------------------------");
        Bukkit.broadcastMessage(getPrefix() + Server.MainColor() + "Server restarting in " + Server.SecondColor()
                + restartseconds + " second(s).");
        Bukkit.broadcastMessage("§7§l§m------------------------------------");
        new BukkitRunnable() {
            public void run() {
                --restartseconds;
                if (restartseconds == 30) {
                    Bukkit.broadcastMessage(getPrefix() + Server.MainColor() + "Server restarting in "
                            + Server.SecondColor() + restartseconds + " second(s).");
                }
                if (restartseconds == 10) {
                    Bukkit.broadcastMessage(getPrefix() + Server.MainColor() + "Server restarting in "
                            + Server.SecondColor() + restartseconds + " second(s).");
                }
                if (restartseconds <= 5) {
                    Bukkit.broadcastMessage(getPrefix() + Server.MainColor() + "Server restarting in "
                            + Server.SecondColor() + restartseconds + " second(s).");
                }
                if (restartseconds == 0) {
                    this.cancel();
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "restart");
                }
            }
        }.runTaskTimerAsynchronously(UHCPlugin.getInstance(), 20L, 20L);
    }

    public void makeFlat(Location loc, Material mat, int r) {
        new BukkitRunnable() {
            public void run() {
                Bukkit.broadcastMessage("§7§l§m------------------------------");
                Bukkit.broadcastMessage(getPrefix() + Server.MainColor() + "Flat " + Server.SecondColor() + r + "x" + r
                        + Server.MainColor() + " has been edited.");
                Bukkit.broadcastMessage("§7§l§m------------------------------");
            }
        }.runTaskLaterAsynchronously(UHCPlugin.getInstance(), 20L * 2);
        clearFlat(loc, r);
        Location newloc = GameManager.getGameManager().getUHCWorld()
                .getBlockAt(0, GameManager.getGameManager().getUHCWorld().getHighestBlockYAt(0, 0), 0).getLocation();
        int cx = newloc.getBlockX();
        int cy = newloc.getBlockY();
        int cz = newloc.getBlockZ();
        World w = loc.getWorld();
        for (int x = cx - r; x <= cx + r; x++) {
            for (int y = cy - 3; y <= cy; y++) {
                for (int z = cz - r; z <= cz + r; z++) {
                    w.getBlockAt(x, y, z).setType(mat);
                }
            }
        }
        for (Player online : Bukkit.getOnlinePlayers()) {
            UHCPlayer uhcplayer = PlayerManager.getPlayerManager().getUHCPlayer(online.getUniqueId());
            if (uhcplayer.isPlayerAlive()) {
                online.teleport(GameManager.this.getScatterLocation());
            }
        }
        Location newloc2 = GameManager.getGameManager().getUHCWorld()
                .getBlockAt(0, GameManager.getGameManager().getUHCWorld().getHighestBlockYAt(0, 0), 0).getLocation();
        buildWalls(r, Material.BEDROCK, 30, w);
        makeRoof(Material.GRASS, r);
        w.getEntities().clear();
    }

    public void makeRoof(Material mat, int r) {
        Location newloc = GameManager.getGameManager().getUHCWorld()
                .getBlockAt(0, GameManager.getGameManager().getUHCWorld().getHighestBlockYAt(0, 0), 0).getLocation();
        int cx = newloc.getBlockX();
        int cy = newloc.getBlockY();
        int cz = newloc.getBlockZ();
        World w = newloc.getWorld();
        for (int x = cx - r; x <= cx + r; x++) {
            for (int y = cy + 10; y <= cy + 10; y++) {
                for (int z = cz - r; z <= cz + r; z++) {
                    w.getBlockAt(x, y, z).setType(mat);
                }
            }
        }

    }

    public void buildWalls(final int size, final Material mat, final int h, final World w) {
        final Location loc = new Location(w, 0.0, 59.0, 0.0);
        for (int i = h; i < h + h; ++i) {
            for (int x = loc.getBlockX() - size; x <= loc.getBlockX() + size; ++x) {
                for (int y = 58; y <= 58; ++y) {
                    for (int z = loc.getBlockZ() - size; z <= loc.getBlockZ() + size; ++z) {
                        if (x == loc.getBlockX() - size || x == loc.getBlockX() + size || z == loc.getBlockZ() - size
                                || z == loc.getBlockZ() + size) {
                            final Location loc2 = new Location(w, (double) x, (double) y, (double) z);
                            loc2.setY((double) w.getHighestBlockYAt(loc2));
                            loc2.getBlock().setType(mat);
                        }
                    }
                }
            }
        }
    }

    public void clearFlat(Location loc, int r) {
        int cx = loc.getBlockX();
        int cy = loc.getBlockY();
        int cz = loc.getBlockZ();
        World w = loc.getWorld();
        for (int x = cx - r; x <= cx + r; x++) {
            for (int y = cy - 30; y <= cy + 30; y++) {
                for (int z = cz - r; z <= cz + r; z++) {
                    w.getBlockAt(x, y, z).setType(Material.AIR);
                }
            }
        }
    }

    public void setPvP(final boolean enabled) {
        if (this.getUHCWorld() != null) {
            this.pvpEnabled = enabled;
            this.getUHCWorld().setPVP(enabled);
            if (Bukkit.getWorld(String.valueOf(this.uhcWorld) + "_nether") != null) {
                Bukkit.getWorld(String.valueOf(this.uhcWorld) + "_nether").setPVP(enabled);
            }
            if (enabled) {
                Bukkit.broadcastMessage(String.valueOf(this.getPrefix()) + Server.SecondColor() + "PvP has been "
                        + "§aenabled. " + Server.MainColor() + "Be careful now :)");
            } else {
                Bukkit.broadcastMessage(String.valueOf(this.getPrefix()) + Server.SecondColor() + "PvP has been "
                        + "§cdisabled. " + Server.MainColor() + "Don't worry now");
            }
        }
    }

    public void healAll() {
        Player[] onlinePlayers;
        for (int length = (onlinePlayers = Bukkit.getServer().getOnlinePlayers()).length, i = 0; i < length; ++i) {
            final Player pl = onlinePlayers[i];
            pl.setHealth(20.0);
            pl.sendMessage(String.valueOf(this.getPrefix()) + Server.MainColor() + "You " + Server.SecondColor()
                    + " have received " + Server.MainColor() + " Final Heal. " + Server.SecondColor()
                    + "There will not be final heals anymore. Be careful about taking damage");
        }
    }

    public void enablePermaDay() {
        this.getUHCWorld().setTime(0L);
        this.getUHCWorld().setGameRuleValue("doDaylightCycle", "false");
        Bukkit.getServer().broadcastMessage(
                String.valueOf(this.getPrefix()) + Server.SecondColor() + "Permanent day has been enabled.");
    }
Depends
» UHCBorder
(Will be included with jar download)

By purchasing this
» You will recive 24/7 support
» Editable things by request (scoreboard or anything else)

Terms and Conditions:
» Do not resell the plugin or the sourcecode
» No refund of the plugin or sourcecode
» The plugin will have updates to add new things
» You can not publish the plugin or the source code anywhere

Config:
License: ""
Populators:
sugar-cane-rate: '20'
cow-rate: '30'
settings:
teamspeak-ip: ip.ts.io
restart-command: /restart
uhc-prefix: UHC
border-prefix: Border
config-prefix: Config
teams-prefix: '&7[&d&lTeams&7] '
specactor-prefix: '&7[&d&lSpecactor&7] '
uhc-world-name: uhc_world
ArenaLocation:
x: 0
y: 64
z: 0
default-map-size: 2000
random-border-shrink-at-and-below: 500
restart-on-game-finish: true
destroy-25x25: false
scoreboard:
title: '&5&lForce | UHC'
Colors:
available-colors: '&f, &3 ,&e , &a, &d, &7, &9, &5, &1, &2, &4, &0, &6'
main-color: '&5'
second-color: '&d'
chat:
default: '&d'
staff: '&e'
stats:
enabled: false
SQL:
ip: localhost
database: databasehere
table: tablenamehere
user: userforDatabase
password: passForUser
server-name: Force | UHC

TODO / FINISH:
Extend config, add more photos to mc-market

Servers that bought the plugin - SpringNetwork,
 
Last edited:
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Aspect Network

Feedback score
1
Posts
63
Reactions
24
Resources
0
Vouch!

Well made , bugs are being fixed so fast.[DOUBLEPOST=1565196329][/DOUBLEPOST]aj nemojmo se svadjat vise xD
 
Last edited:

drzey

Supreme
Feedback score
2
Posts
58
Reactions
16
Resources
1
Vouch bought re-sell rights from me.

Nisi morao sve copy paste mentolu
 

Criwix

MineMexUHC CEO
Premium
Feedback score
10
Posts
28
Reactions
53
Resources
0
Status
This thread has been locked.
Top